Skip to content

fix(py): enforce dependency bounds policy and raise declared floors - #154

Merged
huangjeff5 merged 4 commits into
chore/py-prune-dev-depsfrom
fix/py-dep-bounds-and-floors
Nov 30, 2026
Merged

huangjeff5 merged 4 commits into
chore/py-prune-dev-depsfrom
fix/py-dep-bounds-and-floors

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Part 2 of 4 in the dependency hygiene stack: #153 -> #154 -> #156 -> #157.

Published packages now cap only the deps users can break on, and every declared floor is the oldest version our tests pass against.

# --- BEFORE ---
"pydantic>=2.11"              # contract, uncapped: pydantic 3 installs the day it ships
"opentelemetry-sdk>=1.20.0"   # telemetry imports LogRecordExporter (1.39.0+) -> ImportError on 1.20–1.38
"openai>=1.60.0,<3"           # passes `instructions` (1.68.0+), `prompt_cache_key` (1.99.0+), `verbosity` (1.99.2+)

# --- AFTER ---
"pydantic>=2.11,<3"           # contract: users subclass BaseModel
"starlette>=0.46.1"           # internal detail: stays floor-only; a cap here now fails check_consistency
"opentelemetry-sdk>=1.39.0,<2"
"openai>=1.99.2,<3"

Main Changes

  • Cap integration targets and contracts, nothing else: Previously caps were ad hoc. openai and anthropic were capped, but pydantic, boto3, fastapi, django, flask and opentelemetry-* weren't, so a fresh install could pull an untested major. check_consistency.py now requires a next-major cap (<1 while 0.x) on deps in REQUIRED_CAPS (a genkit package wraps it, or users write code against it) and SCOPED_CAPS (a contract in one package only, e.g. httpx in genkit-google-genai), and rejects caps (<, ~=, ==) on anything else. Capping internal deps like starlette, anyio or uvicorn would block users from upstream fixes and cause solver conflicts with no compatibility upside.
  • Floors raised to the lowest passing versions: tests-minimum-deps (ci(py): gate PRs on oldest supported deps and document dependency policy #156) flagged every stale floor, and testing PyPI releases between each old floor and uv.lock pinned the exact cutoffs: anthropic>=0.98.0, openai>=1.99.2, google-genai>=2.17.0, ollama>=0.6.0, anyio>=4.12.0 in genkit-mcp, and opentelemetry-api/sdk>=1.39.0 + opentelemetry-exporter-gcp-logging>=1.12.0a0 in genkit-google-cloud.
  • Policy tests in version_bounds_guard_test.py: Parametrized cases for a missing floor, a missing required or scoped cap, a cap on an unlisted dep, and scoped caps not leaking into other packages.

How the floors were found

  1. Gate fails on the old floors. With every floor reset to its pre-PR value, tests-minimum-deps (uv lock --resolution lowest-direct, full suite, Python 3.10) fails in all six packages below: 28 failed, 14 errors. CI only tests uv.lock (newest), so none of this showed up before; a user on an older version could install the package and fail at runtime.
  2. Found each exact cutoff. For each failing package, checking release notes and probing PyPI releases between the old floor and uv.lock identified the exact last-failing / first-passing release for all 8 deps.
  3. Gate passes on the new floors. With the full stack applied, tests-minimum-deps passes cleanly.

Why each floor moved

Each boundary is the last FAIL / first PASS, tied to the symbol our code uses.

genkit-google-cloud

  • opentelemetry-sdk 1.20.0 → 1.39.0 (1.38.0 FAIL, 1.39.0 PASS): _telemetry/_config.py imports LogRecordExporter, which OpenTelemetry renamed from LogExporter in 1.39.0 ([logs-api/sdk] Rename several classes from Log to LogRecord open-telemetry/opentelemetry-python#4647). On anything older the telemetry module raises ImportError.
  • opentelemetry-api 1.20.0 → 1.39.0 (1.38.0 FAIL, 1.39.0 PASS): The sdk pins the api to its own version, so the old api floor advertised support that can't install.
  • opentelemetry-exporter-gcp-logging 1.9.0a0 → 1.12.0a0 (1.11.0a0 FAIL, 1.12.0a0 PASS): 1.11.0a0 requires opentelemetry-sdk<1.39.0; 1.12.0a0 is the first release that accepts sdk 1.39.

Provider plugins

  • genkit-anthropic, anthropic 0.96.0 → 0.98.0 (0.97.0 FAIL, 0.98.0 PASS): _plugin.py reads client.credentials, added in 0.98.0. At 0.97.0, 10 tests fail with AttributeError: 'AsyncAnthropic' object has no attribute 'credentials', so a blank per-request key reports INTERNAL instead of INVALID_ARGUMENT.
  • genkit-google-genai, google-genai 2.14.0 → 2.17.0 (2.16.0 FAIL, 2.17.0 PASS): _interactions/_converters.py reads interaction.errors, added in 2.17.0. At 2.16.0, 4 tests fail; a failed Interactions job never exits the poll loop (test_failed_exits_poll_loop).
  • genkit-openai, openai 1.60.0 → 1.99.2 (1.99.1 FAIL, 1.99.2 PASS): _models/_audio.py passes instructions (added in 1.68.0), and chat completions pass prompt_cache_key (added in 1.99.0) and verbosity (added in 1.99.2). At 1.99.1, test_openai_host_keeps_openai_only_settings fails with TypeError: AsyncCompletions.create() got an unexpected keyword argument 'verbosity'.
  • genkit-ollama, ollama 0.5.3 → 0.6.0 (0.5.4 FAIL, 0.6.0 PASS): The README documents OLLAMA_API_KEY, but the SDK only reads it from 0.6.0 (client: load OLLAMA_API_KEY on init ollama/ollama-python#583). At 0.5.4 the env key is silently dropped (test_generate_ollama_secrets_key_does_not_leak_to_next_call sees ['Bearer tenant', None]).

genkit-mcp

@huangjeff5
huangjeff5 force-pushed the fix/py-dep-bounds-and-floors branch from 8a2e7c7 to 924dfa0 Compare November 19, 2026 02:15
@huangjeff5 huangjeff5 changed the title fix(py): enforce dependency bounds policy, raise floors, and gate CI on lowest-deps fix(py): enforce dependency bounds policy and raise declared floors Nov 19, 2026
@huangjeff5
huangjeff5 removed this pull request from stack #155 November 19, 2026 02:19
@huangjeff5
huangjeff5 added this pull request to stack #158 November 19, 2026 02:19
# Conflicts:
#	packages/genkit-a2ui/pyproject.toml
#	packages/genkit-amazon-bedrock/pyproject.toml
#	packages/genkit-anthropic/pyproject.toml
#	packages/genkit-django/pyproject.toml
#	packages/genkit-fastapi/pyproject.toml
#	packages/genkit-flask/pyproject.toml
#	packages/genkit-google-cloud/pyproject.toml
#	packages/genkit-google-genai/pyproject.toml
#	packages/genkit-ollama/pyproject.toml
#	packages/genkit-openai/pyproject.toml
#	packages/genkit-otel/pyproject.toml
huangjeff5 added a commit that referenced this pull request Nov 19, 2026
…together

Two bugs surfaced re-deriving #154's floors with this script:

- Test envs skipped optional extras, so genkit-google-cloud's firestore
  tests failed even at uv.lock versions and the search aborted.
- opentelemetry-sdk pins opentelemetry-api with ==, so bisecting api alone
  paired it with the locked sdk and returned 1.45.0 instead of 1.39.0.
@huangjeff5
huangjeff5 merged commit 98a8f8b into main Nov 30, 2026
20 checks passed
@huangjeff5
huangjeff5 deleted the fix/py-dep-bounds-and-floors branch November 30, 2026 23:37
@huangjeff5 huangjeff5 mentioned this pull request Dec 3, 2026
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.

2 participants