CZ-NIC / pyoidc

A complete OpenID Connect implementation in Python
Other
711 stars 258 forks source link

pydantic 2 seems to be incompatible with oic currently #861

Closed khillman closed 1 year ago

khillman commented 1 year ago

Hi guys,

I use oic in a private aiohttp RP against a keycloak and it works great until now (thanks for the lib). But when I try deploy it today the newest deployment looks like this after the start: ... from oic.oic.message import ClaimsRequest, Claims web_1 | File "/usr/local/lib/python3.11/site-packages/oic/oic/init.py", line 26, in web_1 | from oic import oauth2 web_1 | File "/usr/local/lib/python3.11/site-packages/oic/oauth2/init.py", line 20, in web_1 | from oic.oauth2.base import PBase web_1 | File "/usr/local/lib/python3.11/site-packages/oic/oauth2/base.py", line 16, in web_1 | from oic.utils.settings import PyoidcSettings web_1 | File "/usr/local/lib/python3.11/site-packages/oic/utils/settings.py", line 20, in web_1 | from pydantic import BaseSettings web_1 | File "/usr/local/lib/python3.11/site-packages/pydantic/init.py", line 206, in getattr web_1 | return _getattr_migration(attr_name) web_1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ web_1 | File "/usr/local/lib/python3.11/site-packages/pydantic/_migration.py", line 279, in wrapper web_1 | raise PydanticImportError( web_1 | pydantic.errors.PydanticImportError: BaseSettings has been moved to the pydantic-settings package. See https://docs.pydantic.dev/2.0/migration/#basesettings-has-moved-to-pydantic-settings for more details. web_1 | web_1 | For further information visit https://errors.pydantic.dev/2.0/u/import-error

So after adding "pydantic ~=1.10.10" to my setup.cfg install_requires section it seems works for me again but I guess you want to either adjust oic to pydantic 2 api changes or pin the pydantic version in your setup.py right? As the last release of pydantic 1.10 is from yesterday I guess you did not come across this yet.

wagnerpeer commented 1 year ago

Seems to have already been fixed: #862