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 support #46

Open
abuchnick-aiola opened this issue Jul 3, 2023 · 5 comments · May be fixed by #47
Open

Pydantic v2 support #46

abuchnick-aiola opened this issue Jul 3, 2023 · 5 comments · May be fixed by #47

Comments

@abuchnick-aiola
Copy link

abuchnick-aiola commented Jul 3, 2023

Copying here an issue posted originally on Rocketry, just for the integrity and the tracking - since the problem stems from red-bird.
Miksus/rocketry#210

Is your feature request related to a problem? Please describe.
red-bird is not compatible with Pydantic V2

Describe the solution you'd like
Update Red-Bird (if it is still maintained) to use Pydantic V2

Describe alternatives you've considered
None

Additional context
Pydantic V2 was released on June 30th, and ever since red-bird and Rocketry are not usable.
Traceback for example:

Traceback (most recent call last):
  File "/app/main.py", line 5, in <module>
    from rocketry import Rocketry
  File "/usr/local/lib/python3.9/site-packages/rocketry/__init__.py", line 1, in <module>
    from .session import Session
  File "/usr/local/lib/python3.9/site-packages/rocketry/session.py", line 18, in <module>
    from rocketry.log.defaults import create_default_handler
  File "/usr/local/lib/python3.9/site-packages/rocketry/log/defaults.py", line 1, in <module>
    from redbird.logging import RepoHandler
  File "/usr/local/lib/python3.9/site-packages/redbird/__init__.py", line 2, in <module>
    from .base import BaseRepo, BaseResult
  File "/usr/local/lib/python3.9/site-packages/redbird/base.py", line 116, in <module>
    class BaseRepo(ABC, BaseModel):
  File "/usr/local/lib/python3.9/site-packages/redbird/base.py", line 153, in BaseRepo
    ordered: bool = Field(default=False, const=True)
  File "/usr/local/lib/python3.9/site-packages/pydantic/fields.py", line 675, in Field
    raise PydanticUserError('`const` is removed, use `Literal` instead', code='removed-kwargs')
pydantic.errors.PydanticUserError: `const` is removed, use `Literal` instead
@ManiMozaffar
Copy link

I wish if the code were written with duck typing, tried to somehow upgrade it to v2, but as you can see 83 tests failed...

Screenshot 2023-07-08 at 10 10 53

@ManiMozaffar ManiMozaffar linked a pull request Jul 8, 2023 that will close this issue
@ManiMozaffar
Copy link

#48 gives you tempo fix, without actually using v2's implementation for backward compatibility
#47 would solve problem, but requires many changes.

@ItsCalebJones
Copy link

Any progress on this?

@betterthanever2
Copy link

Is there a roadmap for this? Not being able to use redbird/rocketry with the current version of Pydantic (i.e. at all) is a gigantic bummer

@Euraxluo
Copy link

How about just removing all the type labels

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 a pull request may close this issue.

5 participants