8000 Upgrade to Pydantic V2 by shabani1 · Pull Request #71 · lexy-ai/lexy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Upgrade to Pydantic V2 #71

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

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Upgrade to Pydantic V2 #71

merged 2 commits into from
Mar 26, 2024

Conversation

shabani1
Copy link
Contributor

What

  • Upgrade Pydantic to ^2.6.4
  • Require Pydantic >=2 for lexy-py
    • Update client logic to switch from my_model.dict() to my_model.model_dump()
  • Update IndexRecord models to defer SQLAlchemy logic until table creation
    • Logic is moved to IndexManager.create_index_model
  • Updates to settings in lexy.core.config
  • Additional tests
    • Server tests for Index and Transformer
    • Test filters with invalid conditions

Why

This gives us Rust bindings, with an avg speed improvement of 15x for pydantic-core.

Test plan

  • Run make run-tests and verify that all tests pass
  • Run examples/tests.ipynb and verify that there are no errors
  • Run examples/images.ipynb and verify that the tutorial works as expected

Miscellaneous

NOTE: This PR removes the many deprecation warnings thrown by SQLModel and FastAPI when using Pydantic V1.

This PR contains some updated packages, so remember to update your local env and docker dev containers.

# install new dependencies in local virtual env
source venv/bin/activate
poetry install --no-root --with test,docs,dev -E "lexy_transformers"

# rebuild docker containers and apply migrations
make update-dev-containers

@shabani1 shabani1 linked an issue Mar 26, 2024 that may be closed by this pull request
@shabani1 shabani1 merged commit 580f12e into main Mar 26, 2024
@shabani1 shabani1 deleted the 15-upgrade-to-pydantic-v2 branch March 26, 2024 05:12
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.

Upgrade to Pydantic v2
1 participant
0