Skip to content

chore: fix incompatible with pydantic #442

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
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-rice-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-llama": patch
---

Set pydantic version to <2.10 to avoid incompatibility with llama-index.
1 change: 1 addition & 0 deletions templates/types/extractor/fastapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ python = "^3.11,<4.0"
fastapi = "^0.109.1"
uvicorn = { extras = ["standard"], version = "^0.23.2" }
python-dotenv = "^1.0.0"
pydantic = "<2.10"
llama-index = "^0.11.1"
cachetools = "^5.3.3"
reflex = "^0.6.2.post1"
Expand Down
1 change: 1 addition & 0 deletions templates/types/streaming/fastapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ python = ">=3.11,<3.14"
fastapi = "^0.109.1"
uvicorn = { extras = ["standard"], version = "^0.23.2" }
python-dotenv = "^1.0.0"
pydantic = "<2.10"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update Pydantic version constraint to match FastAPI requirements

The version constraint pydantic = "<2.10" should be updated to match FastAPI's requirements: pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0. This ensures compatibility while preventing known problematic versions.

-pydantic = "<2.10"
+# Match FastAPI's Pydantic requirements to ensure compatibility
+pydantic = ">=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0"
🔗 Analysis chain

Verify Pydantic version compatibility with FastAPI and llama-index

The addition of pydantic = "<2.10" aligns with the PR objective to fix Pydantic compatibility issues. Let's verify this constraint against the requirements of other dependencies.

Consider adding a comment explaining why this specific version constraint is needed:

-pydantic = "<2.10"
+# Pin Pydantic version to maintain compatibility with llama-index
+pydantic = "<2.10"

Pydantic version constraint needs adjustment for FastAPI compatibility

The current constraint pydantic = "<2.10" is too permissive and might allow incompatible versions. FastAPI 0.109.1 specifically requires pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0. Let's verify llama-index's direct Pydantic dependency:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Pydantic version compatibility with FastAPI and llama-index

# Check FastAPI's requirements for Pydantic
curl -s https://raw.githubusercontent.com/tiangolo/fastapi/0.109.1/pyproject.toml | grep -A 5 "dependencies"

# Check llama-index's requirements for Pydantic
curl -s https://raw.githubusercontent.com/run-llama/llama_index/v0.11.17/pyproject.toml | grep -A 10 "dependencies"

Length of output: 2881


Script:

#!/bin/bash
# Check if llama-index-legacy has direct Pydantic requirements
curl -s https://raw.githubusercontent.com/run-llama/llama_index_legacy/v0.9.48/pyproject.toml | grep -A 5 "dependencies" | grep pydantic

Length of output: 136

aiostream = "^0.5.2"
cachetools = "^5.3.3"
llama-index = "^0.11.17"
Expand Down
Loading