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

[BUG] Pydantic Flytekit plugin is not compatible with Pydantic v2 #4603

Open
2 tasks done
adartaud opened this issue Dec 15, 2023 · 5 comments
Open
2 tasks done

[BUG] Pydantic Flytekit plugin is not compatible with Pydantic v2 #4603

adartaud opened this issue Dec 15, 2023 · 5 comments
Assignees
Labels
bug Something isn't working flytekit FlyteKit Python related issue waiting for reporter Used for when we need input from the bug reporter

Comments

@adartaud
Copy link

Describe the bug

Since Pydantic v2, the method __get_validators__ has been removed from pydantic.BaseModel. However as you can see here flytekitplugins-pydantic still uses it.
This raises AttributeError: __get_validators__

Expected behavior

At the moment, there are no constraints on the version of Pydantic in the setup.py of the plugin, although it only seems to be compatible with versions prior to v2.
flytekitplugins-pydantic should be compatible with new versions of Pydantic, or at least specify a constraint while this isn't fixed.

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@adartaud adartaud added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Dec 15, 2023
Copy link

welcome bot commented Dec 15, 2023

Thank you for opening your first issue here! 🛠

Copy link

dosubot bot commented Dec 15, 2023

🤖

It's great to see your interest in improving the compatibility of flytekit with Pydantic v2. Your understanding of the issue and the proposed solution are valuable contributions. Encouraging users like you to take the initiative to create a PR is what helps open-source projects like flyte grow and improve. Keep up the good work, and I hope to see your contribution to flyte soon!


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@eapolinario eapolinario added flytekit FlyteKit Python related issue and removed untriaged This issues has not yet been looked at by the Maintainers labels Dec 21, 2023
@eapolinario
Copy link
Contributor

eapolinario commented Dec 21, 2023

@adartaud , thanks for the report!

We raised a concern about pydantic v2 in flyteorg/flytekit#1660, but it looks like at the time pydantic v2 could be supported. We should validate and increase test coverage if possible.

@adartaud , do you have a repro?

Also, feel free to open a PR to pin the version.

@eapolinario eapolinario added the waiting for reporter Used for when we need input from the bug reporter label Dec 21, 2023
@adartaud
Copy link
Author

Thanks for your reply.
I tested again with up-to-date versions and I still encounter the issue.

Here is a repro:

  1. Create and activate a new virtual env (python -m venv env & source env/bin/activate)
  2. Install these dependencies with pip install -r requirements.txt
# requirements.txt
flytekit==1.10.2
flytekitplugins-pydantic==1.10.2
pydantic==2.5.2
  1. Run a python shell and simply try to run import flytekit. This will raise AttributeError: __get_validators__

@davidmirror-ops
Copy link
Contributor

@adartaud I can repro the behavior you describe here. Nevertheless, when I use the recent flytekitplugins-pydantic-1.11.0 then it works, following the example described in 2217

Can you verify and confirm if it works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flytekit FlyteKit Python related issue waiting for reporter Used for when we need input from the bug reporter
Projects
None yet
Development

No branches or pull requests

3 participants