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

[FEAT] update to pydantic2 #21

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

[FEAT] update to pydantic2 #21

wants to merge 2 commits into from

Conversation

dni
Copy link
Member

@dni dni commented Aug 17, 2023

this request a new major version and i will release 1.0.0 if this PR works

closes #18

this request a new major version and i will release 1.0.0 if this PR works
@brianoflondon
Copy link
Contributor

I think this pydantic.errors.PydanticImportError: pydantic:ConstrainedStr has been removed in V2. needs to be fixed before this can be marked done.

ImportError while importing test module '/Users/bol/Documents/dev/v4vapp/v4vapp-api-ext/tests/podcastindex/test_pi_get.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/Users/bol/.pyenv/versions/3.11.1/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/podcastindex/test_pi_get.py:4: in <module>
    from v4vapp_api_ext.main import app
src/v4vapp_api_ext/main.py:23: in <module>
    from v4vapp_api_ext.helpers.qr_code_avatar import get_hive_avatar
src/v4vapp_api_ext/helpers/qr_code_avatar.py:10: in <module>
    from lnurl import encode as lnurl_encode
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/lnurl/__init__.py:3: in <module>
    from .core import decode, encode, get, handle
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/lnurl/core.py:8: in <module>
    from .models import LnurlAuthResponse, LnurlResponse, LnurlResponseModel
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/lnurl/models.py:7: in <module>
    from .types import (
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/lnurl/types.py:8: in <module>
    from pydantic import (
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/pydantic/__init__.py:210: in __getattr__
    return _getattr_migration(attr_name)
/Users/bol/Library/Caches/pypoetry/virtualenvs/v4vapp-api-ext-cc3pDiTe-py3.11/lib/python3.11/site-packages/pydantic/_migration.py:295: in wrapper
    raise PydanticImportError(f'`{import_path}` has been removed in V2.')
E   pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2.
E   
E   For further information visit https://errors.pydantic.dev/2.1.1/u/import-error

@dni dni marked this pull request as draft August 17, 2023 10:44
@dni
Copy link
Member Author

dni commented Aug 17, 2023

sorry its still a draft :D is going to be a pretty substantial change

@brianoflondon
Copy link
Contributor

Ahh thanks, yeah I thought it would be a bit more intense. I've been fortunate, none of my other API projects have had any issues switching so far.

@dyKiU
Copy link

dyKiU commented Sep 4, 2023

Looked at migration of class LightningNodeUri here The only way I could make it work is to inject a 'lightning://' to make it a valid URL. The tests needed a change which hints at incompatibity going forward. The proper fix would involve changing the rust validation engine. I hope this helps somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrading to Pydantic 2
3 participants