-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor/ support both Pydantic 1 and 2 (#1135)
* kinda large initial commit * avoid recursive-validation issue by validators setting attributes by dict. lock to >= current pydantic * fix no-attribute by .__dict__.get() * ConfigDict for Platform model, plus apparently new pydantic warns about issues with "del"ing attributes * skip more steps in deps cache-hit on CI * tentative change to support both pydantic 1 and pydantic 2 * attempts to set specs and platforms modules based on pydantic version * Created submodules that import/set versions of specs, platforms based on detected pydantic version. Other model ops are performed based on pydantic version * typo * better variables for determining pydantic version, and specs_dump function for dumping specs based on pydantic version * starting universal field and model validators * huge refactoring. only a single specs.py for now. validators.py contains validators for both pydantic versions. pydantic_bindings.py binds validators and other configs to their corresponding classes. only one specs_checkers, utility functions to get/set attributes of pydantic objects * refactoring docs, turning both platforms.py files back into a single file * universal platforms.py * desperately trying to figure out how to do cross-version aliases * with Pydantic2, we need to use merge_field_infos and model_rebuild to retain field defaults and aliases * fix test_models * using create_model to create new model definitions with validators; setting validator attributes directly didn't work since they didn't get bound to fields. various other cross-version fixes and improvements * tiny fix * workflow_dir checking bugfix for pydantic2 validator version * may have just validated a validator * dunno why we always need to do this? * what in tarnation, are we missing a dependency for compilation somehow? * unpin autodoc pydantic * fix pydantic2 validator bug with enabling final_save when save_every_k is enabled * adjust required pydantic version, add jobs for testing old-pydantic * presumably fix matrix? * missing matrices * more matrix fixes * use cross-version wrapper function instead of model_dump in unit test setup * cross-version test_models * fix * adjusts * fix * really dont know why the number of errors is variable, but at least its erroring and displaying multiple? * i just want this to work already... * change these unsets back to del, adjust cache * refactoring * moving some logic to specs_checkers * ignoring a flakey warning from Pydantic, which will presumably be fixed soon? debugging strings * specs_checker_getattr can now return a default value * coverage * adjust new unit test for pydantic 2 * adjust dependency listings for autodoc_pydantic and pydantic 1.10 lower bound
- Loading branch information
Showing
18 changed files
with
581 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
sphinx<8 | ||
sphinxcontrib-bibtex | ||
autodoc_pydantic<2 | ||
autodoc_pydantic | ||
sphinx-design | ||
numpy | ||
sphinx_rtd_theme>1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.