fix: pin pydantic-ai to <2 so the package imports on a fresh install#2
Open
OfficialAbhinavSingh wants to merge 1 commit into
Open
fix: pin pydantic-ai to <2 so the package imports on a fresh install#2OfficialAbhinavSingh wants to merge 1 commit into
OfficialAbhinavSingh wants to merge 1 commit into
Conversation
An unbounded `pydantic-ai>=1.48.0` resolves to pydantic-ai 2.x, which removed `OpenAIModel` from `pydantic_ai.models.openai`. That breaks `import dlens` at `src/dlens/agents/_models.py:2`, so a fresh `uv sync` + `uv run pytest` fails at collection on the smoke test. Pin to the 1.x line the current code targets (the `OpenAIModel` wrapper and imports use the 1.x API). Verified: fresh `uv sync` then `uv run pytest` passes (test_ping) with pydantic-ai 1.107.1. Migrating to pydantic-ai 2.x (OpenAIChatModel/OpenAIResponsesModel) is a larger follow-up and left out of this minimal fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On a fresh clone,
uv sync+uv run pytestfails at collection:Root cause:
pyproject.tomlpinspydantic-ai>=1.48.0with no upper bound, souvresolves pydantic-ai 2.x (currently 2.12.0). In the 2.x line,OpenAIModelwas removed frompydantic_ai.models.openai(split intoOpenAIChatModel/OpenAIResponsesModel). Theimport dlenschain hits_models.py:2and the whole package — and therefore the smoke test and every script — fails to import.Reproduce
Fix
Pin to the 1.x line the current code targets (the
OpenAIModelwrapper at_models.py:12and the import at:2use the 1.x API):Verification
After the pin, a fresh
uv syncresolves pydantic-ai 1.107.1 and:Note
Migrating to pydantic-ai 2.x (
OpenAIChatModel/OpenAIResponsesModel, updating theOpenAIModelwrapper) is a larger, separate change — deliberately left out here to keep this a minimal "repo builds on a fresh clone again" fix. Happy to follow up with the 2.x migration if that's the preferred direction.