Skip to content

Pydantic v2 #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft

Pydantic v2 #2433

wants to merge 5 commits into from

Conversation

yaugenst-flex
Copy link
Collaborator

@yaugenst-flex yaugenst-flex commented May 8, 2025

This is not done, just to keep you updated @momchil-flex @daquinteroflex @tylerflex

It'll be a pretty big PR so might not be a bad idea to have an early look...

Status of tests

  • test_components
    • material
      • test_multi_physics.py
    • test_apodization.py
    • test_autograd_mode_polyslab_numerical.py
    • test_autograd_numerical.py
    • test_autograd.py
    • test_base.py
    • test_bc_placement.py
    • test_beam.py
    • test_boundaries.py
    • test_custom.py
    • test_eme.py
    • test_field_projection.py
    • test_frequencies.py
    • test_geometry.py
    • test_grid_spec.py
    • test_grid.py
    • test_heat_charge.py
    • test_heat.py
    • test_IO.py
    • test_layerrefinement.py
    • test_lumped_element.py
    • test_medium.py
    • test_meshgenerate.py
    • test_microwave.py
    • test_mode.py
    • test_monitor.py
    • test_packaging.py
    • test_parameter_perturbation.py
    • test_perturbation_medium.py
    • test_scene.py
    • test_sidewall.py
    • test_simulation.py
    • test_source.py
    • test_structure.py
    • test_time_modulation.py
    • test_types.py
    • test_viz.py
  • test_data
    • test_data_arrays.py
    • test_datasets.py
    • test_monitor_data.py
    • test_sim_data.py
  • test_material_library
    • test_material_library.py
  • test_package
    • test_compat.py
    • test_config.py
    • test_convert.py
    • test_log.py
    • test_main.py
    • test_make_script.py
    • test_material_library.py
    • test_parametric_variants.py
  • test_plugins
    • autograd
      • invdes
        • test_filters.py
        • test_parametrizations.py
        • test_penalties.py
      • primitives
        • test_interpolate.py
        • test_misc.py
      • test_differential_operators.py
      • test_functions.py
      • test_utilities.py
    • expressions
      • test_functions.py
      • test_operators.py
      • test_variables.py
    • pytorch
      • test_wrapper.py
    • smatrix
      • test_component_modeler.py
      • test_terminal_component_modeler.py
    • test_adjoint.py
    • test_array_factor.py
    • test_design.py
    • test_dispersion_fitter.py
    • test_invdes.py
    • test_microwave.py
    • test_mode_solver.py
    • test_polyslab.py
    • test_resonance_finder.py
    • test_waveguide.py
  • test_web
    • test_cli.py
    • test_env.py
    • test_material_fitter.py
    • test_task.py
    • test_tidy3d_folder.py
    • test_tidy3d_material_library.py
    • test_tidy3d_task.py
    • test_webapi_account.py
    • test_webapi_eme.py
    • test_webapi_heat.py
    • test_webapi_mode_sim.py
    • test_webapi_mode.py
    • test_webapi.py

@yaugenst-flex yaugenst-flex self-assigned this May 8, 2025
@yaugenst-flex yaugenst-flex added the 2.9 will go into version 2.9.* label May 8, 2025
@yaugenst-flex yaugenst-flex linked an issue May 8, 2025 that may be closed by this pull request
@yaugenst-flex yaugenst-flex force-pushed the yaugenst-flex/pydantic-v2 branch from 0a529f4 to a7e7a49 Compare May 9, 2025 07:10
@yaugenst-flex yaugenst-flex mentioned this pull request May 9, 2025
@yaugenst-flex yaugenst-flex force-pushed the yaugenst-flex/pydantic-v2 branch 2 times, most recently from 348a931 to 5ecc9f9 Compare May 9, 2025 20:08
@momchil-flex
Copy link
Collaborator

It seems like fundamentally there's just a few things that change? Maybe I'm missing something important/tricky. Could you explain if there's anything like that, and what changes going forward?

Also very important - we will certainly need to update the backend python code too and might need to update denormalizer, metadata api, and who knows what else.

@yaugenst-flex
Copy link
Collaborator Author

Yes the biggest changes are related to custom types and serialization, everything else is relatively straightforward. I'll write something up.

@yaugenst-flex yaugenst-flex force-pushed the yaugenst-flex/pydantic-v2 branch from 93ce359 to dd10b26 Compare May 14, 2025 15:36
@yaugenst-flex yaugenst-flex force-pushed the yaugenst-flex/pydantic-v2 branch 2 times, most recently from 18e6439 to a4f762f Compare May 15, 2025 16:50
add somefiles

replacing v1

more replacements

copy methods and ordering of basemodel

update get_submodels_by_hash

basemodel done (except for docs)

basemodel and modespec done

slowly but surely..

progress

next batch

going going

getting started on medium

more refactoring

new structure for medium.py

add medium

why it no work

fix medium

upgrade material library

most of it

first pass

add pydantic-settings

fixes to validators, mutable assignment, ...:

remove skip_if_fields_missing

cleaning up types & type serializaton

fix printing and serialization of autograd types

more type serialization updates

Fix traced ndarray serialization

fix equality check in basemodel

fix some v1 leftovers

fix some tests

fix equality check

sim_data tests passing

make serializer more robust and another fix for equality comparison

fix warn if none validators

Check for pydantic v2 ValidationErrors

Canonicalize coordinate handling of unstructured datasets

Simulation data tests passing

material library tests passing

fix bad name

fix material libray -> library

lotsa fixes, tests_web & test_package passing

fix remaining web test warnings

everything importable for doctests

rebase, wip

fix mutation

safer ndarray coercion and expressions fix

working on post init validation

fix multiphysics medium attribute lookup

remove test script from vcs

doctests passing

fix NedeljkovicSorefMashanovich

fix non-component tests

fix tracer serialization

remove unnecessary to_static call

the smallest changes really do take the longest

all of test_IO passing

fix caching and copy update

docstring for __init_subclass__
@yaugenst-flex yaugenst-flex force-pushed the yaugenst-flex/pydantic-v2 branch from dd0cd2b to 38d502a Compare May 16, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.9 will go into version 2.9.*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full Pydantic v2 upgrade ⏫
2 participants