Closed CasperWA closed 1 year ago
@quaat and @Treesarj, I think I'll merge this. It shouldn't change any contents, really, just update usage of pydantic to pydantic v2 styling - and then there's a bit of static typing updates as well.
Since both oteapi-core
and otelib
now support pydantic v2, there are no dependency issues any longer.
Use new way of configuring models and new type of validators.
Closes #12
I put this as a draft for now, to determine whether other parts of the code should be re-written according to new pydantic v2 functionality. Like, e.g., the dynamic model creation using
create_model()
.Furthermore, since dependencies of this package pin pydantic to v1 still, it is difficult to see an update happening right now.
~This PR now does a few things, along with migrating to pydantic v2~ (EDIT: Nope, it just migrates):
from __future__ import annotations
, which should be removed once the minimum required Python version is set to 3.10). EDIT: This has been reverted - it doesn't work. Since Python 3.9 is the minimum supported version, Python 3.9 style typing has been implemented everywhere. Note, this can also be done dynamically using thepyupgrade
package with the--py39-plus
option (for example as a pre-commit hook, if so desired).