pydantic v1 => v2 - #7
Merged
Merged
Conversation
- Auto-negotiate external index with/without field parameter to support both old binaries (require field) and new source (reject field with external) - Fix chroma bench script to use uv pip instead of missing bin/pip - Add environs to chroma venv deps
- PYTHON defaults to .venv/bin/python instead of hardcoded home dir - antfly client skips table/index creation when they already exist (enables --skip-load reuse runs)
chromadb requires pydantic>=2 but the project pinned pydantic<v2, causing an ImportError on the chroma benchmark. This migrates all pydantic v1 patterns to v2: @validator("*") → @model_validator(mode="before"), @root_validator → @model_validator, .dict() → .model_dump(), .json() → .model_dump_json(), PrivateAttr → ClassVar, and adds explicit = None defaults for Optional fields (required in v2). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add validate_default=True to DBConfig so SecretStr fields with string defaults (e.g. host: SecretStr = "localhost") are properly coerced during construction. Without this, pydantic v2 skips validation on defaults, leaving raw strings that crash model_dump_json serialization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts: - Makefile: accept deletion (superseded by parent repo's Makefile) - antfly.py: take fix/pydantic-v2 side (direct store search, index reuse, field compat) and incorporate _httpx_host() fix from main for macOS IPv6 localhost resolution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add minimal Makefile with lint and unittest targets (CI needs these) - Fix black formatting (blank lines removed during migration) - Fix ruff: sort imports, remove unused SecretStr import, extract f-strings from exception constructors (EM102) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Migrate all pydantic v1 patterns to v2, required because chromadb depends on pydantic>=2 which conflicts with this project's
pydantic<v2 pin.
What changed
This is a mechanical migration with no behavioral changes:
tidb) had per-field empty-string validators; these become a single mode="before" model validator with identical logic
verification
Also incorporates the _httpx_host() fix from main (IPv6 localhost resolution on macOS).
What did NOT change
Test plan