-
Notifications
You must be signed in to change notification settings - Fork 14
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
DM-40002: Try to support pydantic v1 and v2 #866
Commits on Jul 14, 2023
-
Fix some tests that require optional dependencies
We always tend to install the optionals for testing but it turns out the import tests were not working properly. Consider removing S3 completely.
Configuration menu - View commit details
-
Copy full SHA for 6eeb67c - Browse repository at this point
Copy the full SHA 6eeb67cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0bd4a79 - Browse repository at this point
Copy the full SHA 0bd4a79View commit details
Commits on Jul 17, 2023
-
Initial attempt to support pydantic v2
Still some failures. Lots of deprecation warnings.
Configuration menu - View commit details
-
Copy full SHA for 2e913d3 - Browse repository at this point
Copy the full SHA 2e913d3View commit details -
For storage class conversion test use usable storage classes
AstropyArrow and Dataframe use classes that are not part of the core butler dependencies. This leads to the tests failing in a minimal environment. Replace with two storage classes that are available to the core environment.
Configuration menu - View commit details
-
Copy full SHA for afe26c4 - Browse repository at this point
Copy the full SHA afe26c4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e19163 - Browse repository at this point
Copy the full SHA 7e19163View commit details
Commits on Jul 18, 2023
-
Use model_construct for pydantic v2
This is meant to be the rquivalent of using __setattr__ and __field_set__ directly. The latter has been renamed in pydantic v2
Configuration menu - View commit details
-
Copy full SHA for 56d2a1e - Browse repository at this point
Copy the full SHA 56d2a1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for d3eee16 - Browse repository at this point
Copy the full SHA d3eee16View commit details -
Configuration menu - View commit details
-
Copy full SHA for 37afb3f - Browse repository at this point
Copy the full SHA 37afb3fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e129be - Browse repository at this point
Copy the full SHA 2e129beView commit details -
Pydantic/fastAPI no longer handle generic Mapping for Config classes
This all worked before but now we have to force the Config to a plain dict before it will be accepted.
Configuration menu - View commit details
-
Copy full SHA for e0894c6 - Browse repository at this point
Copy the full SHA e0894c6View commit details -
There is clearly some issue with the RootModel constructor that we will need to sort out.
Configuration menu - View commit details
-
Copy full SHA for e96015d - Browse repository at this point
Copy the full SHA e96015dView commit details -
Fix mypy for pydantic v1 and v2
This required that we allow unused igores since the location of the ignores depends on the version of pydantic and mypy always picks up the first definition it sees even if that is a pydantic V2 code path and pydantic is v1.
Configuration menu - View commit details
-
Copy full SHA for 92a5351 - Browse repository at this point
Copy the full SHA 92a5351View commit details -
Configuration menu - View commit details
-
Copy full SHA for 45d95e6 - Browse repository at this point
Copy the full SHA 45d95e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for eba136b - Browse repository at this point
Copy the full SHA eba136bView commit details
Commits on Jul 19, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 594b379 - Browse repository at this point
Copy the full SHA 594b379View commit details -
Use model_construct in direct methods
If the BaseModel.construct() method is slow we can still reimplement it as was done in the individual direct() methods but with the direct() methods still being much simpler.
Configuration menu - View commit details
-
Copy full SHA for f6cfafa - Browse repository at this point
Copy the full SHA f6cfafaView commit details -
Add note about use of BaseModel.construct
The previous version used by the direct() methods would be something like: def model_construct(cls, _fields_set: set[str] | None = None, **values: Any) -> Self: node = cls.__new__(cls) setter = object.__setattr__ for k, v in values.items(): setter(node, k, v) if _fields_set is None: _fields_set = set(values.keys()) setter(node, "__fields_set__", _fields_set) return node Testing with 100MB graph indicates that construct() might be fractionally slower than implementing it ourselves as above but it is not conclusive. The direct() method only accounts for 14% of the graph load time.
Configuration menu - View commit details
-
Copy full SHA for 50673f4 - Browse repository at this point
Copy the full SHA 50673f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1ce5be8 - Browse repository at this point
Copy the full SHA 1ce5be8View commit details