Skip to content

fix(py): cap anthropic dependency below 1.0 and require flask[async] - #42

Merged
huangjeff5 merged 9 commits into
mainfrom
fix/py-0.13.1-hotfix-pins
Nov 10, 2026
Merged

huangjeff5 merged 9 commits into
mainfrom
fix/py-0.13.1-hotfix-pins

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Fresh installs of genkit-anthropic and genkit-flask from PyPI break at runtime. Neither shows up in CI, because the workspace venv carries every package's dependencies.

# 1. genkit-anthropic resolved anthropic 1.x or 2.x
ai = Genkit(plugins=[Anthropic()], model=Anthropic.claude('claude-sonnet-4-6'))
await ai.generate(prompt='Summarize quarterly earnings.', config={'temperature': 0.7})
# before => TypeError: AsyncMessages.create() got an unexpected keyword argument 'temperature'
# after  => anthropic resolves <1; the request goes through

# 2. genkit-flask installed without asgiref
client.post('/greet', json={'data': 'Ada'})
# before => 500, RuntimeError: Install Flask with the 'async' extra in order to use async views.
# after  => 200

Main Changes

  • Cap anthropic below 1: anthropic 1.0 removed temperature/top_p/top_k from messages.create() and switched its transport from httpx to httpx2. The plugin forwards those kwargs and catches httpx exceptions. On 1.x, any sampling config raises TypeError and the timeout/network handlers stop firing. 2.x has the same shape. We pin anthropic>=0.96.0,<1 until the plugin moves to the new SDK.
  • Depend on flask[async]: genkit_flask_handler returns an async def view, and Flask only runs those when asgiref is installed. CI never saw the failure because genkit-django pulls asgiref into the shared venv.
  • Smoke each wheel in its own venv: bin/check_isolated_wheels runs in the build job. It installs every built genkit* wheel into a fresh venv resolved from PyPI and imports it. It also POSTs to a Flask async flow and checks the installed anthropic create() signature. With the old flask pin it fails on genkit_flask (smoke).

Lockfile: specifier changes only, plus the flask[async] -> asgiref edge. anthropic stays at 0.112.0.

Breaking changes

None.

anthropic 1.0.0 removed temperature/top_p/top_k from messages.create()
and moved the transport to httpx2. genkit-anthropic forwards those kwargs
and catches httpx exceptions, so every fresh install that resolved
anthropic>=1 raised TypeError on sampling config. Cap at <1 until the
plugin is adapted (BL-22).
genkit_flask_handler returns an async view. Flask needs asgiref (the
async extra) to run it; without it the first request fails with
'Install Flask with the async extra'. The monorepo venv masked this
because genkit-django pulls asgiref.
The workspace venv carries every package's dependencies, so a package
that forgets one (genkit-flask without flask[async]) passes CI and
breaks on PyPI. check_isolated_wheels installs each built genkit wheel
into its own venv and imports it, with targeted smokes for genkit-flask
(async view request) and genkit-anthropic (SDK create() signature).
@huangjeff5 huangjeff5 changed the title fix(py): hotfix anthropic dependency cap and flask[async] fix(py): cap anthropic dependency below 1.0 and require flask[async] Nov 10, 2026
@huangjeff5
huangjeff5 requested a review from hilariie November 10, 2026 04:10
This repo builds into ./dist. The py/dist fallback and py/bin usage line
were carried over from the monorepo port.

@cabljac cabljac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with comments

Comment thread bin/check_isolated_wheels Resolved
@huangjeff5
huangjeff5 enabled auto-merge (squash) November 10, 2026 18:37
@huangjeff5
huangjeff5 disabled auto-merge November 10, 2026 18:44
@huangjeff5
huangjeff5 enabled auto-merge (squash) November 10, 2026 18:45
@huangjeff5
huangjeff5 merged commit 5b5c22d into main Nov 10, 2026
21 checks passed
@huangjeff5
huangjeff5 deleted the fix/py-0.13.1-hotfix-pins branch November 10, 2026 18:45
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