Skip to content

fix(deps): bump typer to >=0.20.0 so the CLI works with click >=8.3 (#650)#663

Open
Anai-Guo wants to merge 1 commit into
michaelfeil:mainfrom
Anai-Guo:fix/typer-bump-click8.3
Open

fix(deps): bump typer to >=0.20.0 so the CLI works with click >=8.3 (#650)#663
Anai-Guo wants to merge 1 commit into
michaelfeil:mainfrom
Anai-Guo:fix/typer-bump-click8.3

Conversation

@Anai-Guo
Copy link
Copy Markdown

@Anai-Guo Anai-Guo commented Jun 4, 2026

Problem

Running the CLI (infinity_emb v2 ...) crashes at startup when click >= 8.2/8.3 is installed:

TypeError: Secondary flag is not valid for non-boolean flag.

(Reported in #650; #649 users hit it after pip install infinity[all] pulls a recent click.)

Root cause

Several CLI options in libs/infinity_emb/infinity_emb/cli.py are declared as list[bool], e.g.:

trust_remote_code: list[bool] = typer.Option(...)
model_warmup:      list[bool] = typer.Option(...)
compile:           list[bool] = typer.Option(...)
onnx_disable_optimize: list[bool] = typer.Option(...)
# ... and more

typer 0.12.x auto-generates a secondary --no-<flag> for each bool, but for a multiple (list[...]) option click 8.2+ now rejects a secondary flag, raising the error above. typer's click-param generation was fixed in later releases — as confirmed in #650, bumping typer makes the error disappear (typer 0.12.5 + click 8.3.0 crashes; recent typer does not).

Fix

The ^0.12.5 constraint pinned typer to the broken 0.12.x line. This bumps the lower bound to >=0.20.0 (the version confirmed working in #650 by @wirthual); poetry lock --no-update resolves typer 0.23.2, which emits click-8.3-compatible params. The poetry.lock change is minimal — only the typer entry, its new transitive dep annotated-doc, and the content hash.

poetry check --lock passes.

If you've verified an even lower typer release works, feel free to relax the bound — I used >=0.20.0 because that's the value explicitly confirmed in the thread.

Closes #650

🤖 Generated with Claude Code

typer 0.12.x generates an invalid secondary (--no-) flag for the
list[bool] CLI options (trust_remote_code, model_warmup, compile, ...),
which click >=8.2/8.3 rejects with "Secondary flag is not valid for
non-boolean flag", crashing `infinity_emb v2` at startup (michaelfeil#650).

The `^0.12.5` constraint pinned typer to the broken 0.12.x line. Recent
typer (confirmed working: 0.20.0+, this lock resolves 0.23.2) emits
click-8.3-compatible params, so the CLI imports and runs again.

Closes michaelfeil#650
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the typer dependency constraint in pyproject.toml from ^0.12.5 to >=0.20.0. Consequently, the poetry.lock file has been updated, upgrading typer to version 0.23.2 and adding the annotated-doc package as a dependency. No review comments were provided, so there is no additional feedback.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR bumps the typer lower-bound from ^0.12.5 to >=0.20.0 to resolve a startup crash (TypeError: Secondary flag is not valid for non-boolean flag) that occurs when click >= 8.2/8.3 is paired with typer 0.12.x. The lock file is regenerated with poetry lock --no-update, resolving to typer 0.23.2 and pulling in one new transitive dependency (annotated-doc).

  • pyproject.toml: removes the caret (^) upper-bound pin and raises the minimum to >=0.20.0, the first confirmed-working release per the linked issue thread.
  • poetry.lock: updates the typer entry from 0.12.5 → 0.23.2, adds the annotated-doc >= 0.0.2 transitive dependency, and refreshes the content hash.

Confidence Score: 4/5

Safe to merge — the dependency bump directly fixes a known startup crash on click >= 8.2/8.3 with no changes to application logic.

The change is a targeted fix for a well-understood compatibility breakage. The only concerns are the missing upper-bound on the typer version range and the unexpected python_version < 3.10 marker on click in the typer 0.23.2 lock entry. Neither issue affects correctness at merge time.

No files require special attention beyond verifying that the production extras (server, all) continue to supply click independently of any dev-group transitive path on Python 3.10+.

Important Files Changed

Filename Overview
libs/infinity_emb/pyproject.toml Relaxes typer constraint from ^0.12.5 to >=0.20.0; the fix is correct but leaves no upper-bound ceiling for future major releases.
libs/infinity_emb/poetry.lock Lock updated to typer 0.23.2; adds annotated-doc 0.0.4 transitive dep; click dependency on the typer entry carries a python_version < 3.10 marker that warrants a second look.

Reviews (1): Last reviewed commit: "fix(deps): bump typer to >=0.20.0 so the..." | Re-trigger Greptile

prometheus-fastapi-instrumentator = {version = ">=6.1.0", optional=true}
uvicorn = {version = "^0.32.0", optional=true, extras = ["standard"]}
typer = {version = "^0.12.5", optional=true}
typer = {version = ">=0.20.0", optional=true}
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.

P2 The new constraint has no upper bound. While removing the caret was necessary to escape the broken 0.12.x line, an uncapped >=0.20.0 means any future major version of typer (e.g., a hypothetical 1.0 with breaking API changes) will satisfy the constraint. A loose upper cap like <2 preserves flexibility for all 0.x releases while guarding against unvetted major-version upgrades.

Suggested change
typer = {version = ">=0.20.0", optional=true}
typer = {version = ">=0.20.0,<2", optional=true}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines 4386 to 4391
[package.dependencies]
click = ">=8.0.0"
rich = ">=10.11.0"
annotated-doc = ">=0.0.2"
click = {version = ">=8.0.0", markers = "python_version < \"3.10\""}
rich = ">=12.3.0"
shellingham = ">=1.3.0"
typing-extensions = ">=3.7.4.3"

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.

P2 Click declared Python-version-conditional by typer 0.23.2

The resolved typer 0.23.2 entry declares click only for python_version < "3.10". Typer is fundamentally built on click for all Python versions, so this marker looks like a metadata quirk in that specific release. In this lock file click 8.1.7 ends up as optional = false (pulled in via another path, likely jinja2-cli in the test group), so the runtime dependency chain stays intact today. However, if the non-optional click path is ever removed, users on Python 3.10+ would be missing click at import time and the CLI would crash. Worth verifying that the production extras (server, all) reliably pull in click independent of the test group.

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.

Running infinity cli with click >8.2.1 fails with TypeError: Secondary flag is not valid for non-boolean flag

1 participant