Migrate ChromaDB from Pydantic v1 to v2 for Python 3.14.0 compatibility #5842
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
Complete migration to Pydantic v2, removing all v1 compatibility layers
and updating dependencies for Python 3.14.0 support.
Dependencies:
chromadb/config.py:
chromadb/server/fastapi/init.py:
chromadb/types.py:
rust/python_bindings/Cargo.toml:
All compatibility shims removed for a cleaner Pydantic v2-only codebase.
Tested with Python 3.14.0.
Test plan
Setup venv as necessary. Installs should be in the intended venv. e.g. source /path/to/venv/bin/activatge
Clone onnxruntime (1.23.2) and install
Install works after manually cloning onnxruntime (latest 1.23.2), building from source, and installing.
On Mac:
./build.sh --config Release --build_wheel --parallel --skip_tests --use_coremlProduces this artifact in
pip install onnxruntime-1.24.0-cp314-cp314-macosx_15_0_arm64.whlInstall via:
pip install -e .Latest chromadb should be working in Python 3.14.0 with your project.
I hope this helps other people trying to get recent ChromaDB working with Python 3.14.0.
pytestfor python,yarn testfor js,cargo testfor rustMigration plan
Pydantic V1 to Pydantic V2. This allows projects to use Pydantic V2. This is a breaking change.
Observability plan
This is a breaking change.
Documentation Changes
Yes, since dependencies were updated. Pydantic V2.