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 compatibility #445

Closed
minrk opened this issue Nov 8, 2023 · 4 comments
Closed

pydantic v2 compatibility #445

minrk opened this issue Nov 8, 2023 · 4 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@minrk
Copy link
Contributor

minrk commented Nov 8, 2023

Description

Making sure it's tracked that jupyter-ai currently requires an outdated pydantic, preventing it from being used in up-to-date environments with other packages, e.g. fastapi.

#285 (comment) noted that upgrading langchain past 0.0.267 supports pydantic v2, but #375 which closed #285 pins down to outdated pydantic v1.

There do appear to be some updates required for pydantic v2 support, e.g.:

File ~/conda/lib/python3.10/site-packages/jupyter_ai_magics/providers.py:235
    230     @property
    231     def allows_concurrency(self):
    232         return True
--> 235 class AI21Provider(BaseProvider, AI21):
    236     id = "ai21"
    237     name = "AI21"

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Reproduce

  1. pip install jupyter-ai fastapi[all]
  2. watch pip backtrack, trying to find a satisfiable install plan

Expected behavior

up-to-date jupyter-ai is compatible with up-to-date versions of its dependencies, so it can work in an env with other packages that share those dependencies and are up-to-date.

Context

  • Operating System and version:macOS 14.1
  • Browser and version: not relevant
  • JupyterLab version: 4.0.7
@minrk minrk added the bug Something isn't working label Nov 8, 2023
Copy link

welcome bot commented Nov 8, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@dlqqq
Copy link
Member

dlqqq commented Nov 8, 2023

@minrk Thank you for taking the time to document this issue in writing! Yes, this is absolutely a high priority issue for us; we are aware that we are often forcing environments to resolve Pydantic to v1. We are wildly busy with a few other things at the moment, but plan to address this in the next couple of weeks. 👍

@dlqqq dlqqq added enhancement New feature or request and removed bug Something isn't working labels Nov 8, 2023
@JasonWeill
Copy link
Collaborator

@minrk Thanks for opening this! We already have a Pydantic 2 issue, so I'm going to close this as a duplicate of #390.

@JasonWeill JasonWeill added the duplicate This issue or pull request already exists label Nov 8, 2023
@minrk
Copy link
Contributor Author

minrk commented Nov 9, 2023

Arg, sorry for the dupe. Do not know how my search didn't turn up that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants