AirbusDefenceAndSpace / pesto

PESTO provides a set of tools to ease the process of packaging a Python algorithm as a processing web service into a docker image. The deployment of a web service becomes now as easy as filling few configuration files.
https://airbusdefenceandspace.github.io/pesto
Apache License 2.0
24 stars 8 forks source link

Support for Pydantic v2 #34

Open ctraizet opened 1 year ago

ctraizet commented 1 year ago

Pydantic v2 is now the default version of Pydantic packaged in pip (https://docs.pydantic.dev/latest/migration/#install-pydantic-v2), but pesto does not support this, as this import does not work : https://github.com/AirbusDefenceAndSpace/pesto/blob/0d4491bace0a2470afadc3b67ee34d17a02ca18f/pesto-cli/pesto/ws/config.py#L2

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/pydantic/__init__.py", line 206, in __getattr__
    return _getattr_migration(attr_name)
  File "/usr/local/lib/python3.8/site-packages/pydantic/_migration.py", line 279, in wrapper
    raise PydanticImportError(
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.0.2/migration/#basesettings-has-moved-to-pydantic-settings for more details.

A current workaround is to use an old version of pydantic, which is still available in pip.

tapiab commented 1 year ago

Pydantic V2 support in FastAPI is still in progress, until this done, it is better to stay in V1