Skip to content
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

Pydantic v2 Overhaul [DNM yet] #321

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Commits on Aug 1, 2023

  1. Configuration menu
    Copy the full SHA
    4777b4b View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2023

  1. Finish initial pass converting to v2 pydantic API. Have not done any …

    …testing so very much a WIP still.
    Lnaden committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    538a62f View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2023

  1. More headway, starting on tests. have to be careful with serializers …

    …and only use json on numpy arrays for now.
    Lnaden committed Aug 4, 2023
    Configuration menu
    Copy the full SHA
    5bd215b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    76b565b View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2023

  1. Configuration menu
    Copy the full SHA
    248676d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a2e3501 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2023

  1. This is the dumbest dependency tree resolution. Autodoc-pydantic requ…

    …ires python 3.7.1+, but apparently pinning python to `^3.7` which is supposed to be equivalent to `>=3.7, <4.0` doesn't let the stack resolve, so pinning python to `^3.7.1` was the correct solution, even though it should have resolved...
    Lnaden committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    86d88f9 View commit details
    Browse the repository at this point in the history
  2. fix black

    Lnaden committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    e7f4549 View commit details
    Browse the repository at this point in the history
  3. and apparently isort

    Lnaden committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    4b4c977 View commit details
    Browse the repository at this point in the history
  4. So apparently I made a fun problem where black and isort undid each o…

    …ther. I moved the commented block in case we needed to change it later.
    Lnaden committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    541beb0 View commit details
    Browse the repository at this point in the history
  5. Types from typing before Python 3.10 didn't have a __name__ attribu…

    …te, so split it up the hard way since there doesn't appear to be any other way to acess the name.
    
    This is the single most frustrating bug to track down since the error is thrown in pydantic but doesn't backtrace through the pydantic.__getattr__ -> `AutoPydanticDocGenerator` -> `__get__` -> `doc_formatter` -> `annotation.__name__` function because all the exceptions are caught the whole way up. GYA!
    Lnaden committed Aug 10, 2023
    Configuration menu
    Copy the full SHA
    e32570b View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2023

  1. A found an even more frustrating bug with Numpy NDArray from numpy.ty…

    …ping and pre Python3.9 in tandem with typing_extensions Annotation
    
    Source information: beartype/beartype#42
    
    Annotated checks against instances of _GenericAlias to see if you can support Data[type_info], e.g. NDArray[int] (in Python types since 3.9, and kinda of as _GenricAlias before that.) Prior to 3.9, Numpy implemented their own version of _GenericAlias which isn't Python _GenericAlias, so the types are not considered "Generic" when Annotated[NDArray, Metadata][type_info] does its thing. So. This fix code does the heavy lifting to re-cast the NDArray type with _GenericAlias from python typing. I've tried to reuse as much data from NDArray as I possibly can and still use np.ndarray (which is not np.typing.NDArray) to still correctly type hint np.ndarrays.
    Lnaden committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    6201290 View commit details
    Browse the repository at this point in the history
  2. One last doc bug and black

    Lnaden committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    ad7d43b View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2023

  1. Fixed a serialization problem in Datum because you cannot chain seria…

    …lization wrappers together. Who knew? Also fixed an issue where the default `model_dump` wasn't calling the correct settings.
    Lnaden committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    a4d0ed2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    37fcc09 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    31f0b7c View commit details
    Browse the repository at this point in the history
  4. black

    Lnaden committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    ad3b633 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2023

  1. Configuration menu
    Copy the full SHA
    6af962b View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2023

  1. Configuration menu
    Copy the full SHA
    01f19ae View commit details
    Browse the repository at this point in the history
  2. Fixed typo in Array serialization to JSON where flatten was not calle…

    …d as a function first before calling tolist
    Lnaden committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    f2b5989 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2ca4b14 View commit details
    Browse the repository at this point in the history
  4. For serializing models, just try dumping them with model_dump_json wh…

    …ich calls different logic overall than to_jsonable_python for some reason I don't understand
    Lnaden committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    75e6aee View commit details
    Browse the repository at this point in the history