fix: add click to base install dependencies#610
Merged
Conversation
`tesseract_core/sdk/cli.py` imports `click` unconditionally (alongside `typer`) and the SDK CLI is exposed via `[project.scripts]`, so `click` must be installed as part of the base package. Previously it was only listed under the `runtime` extra, which worked in practice because older `typer` versions pulled `click` in as a hard transitive dependency. Newer `typer` releases no longer guarantee this, causing `Test pip install (latest)` jobs to fail with `ModuleNotFoundError: No module named 'click'`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jpbrodrick89
requested review from
apaleyes,
dionhaefner and
xalelax
as code owners
May 27, 2026 09:38
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #610 +/- ##
==========================================
- Coverage 77.13% 77.08% -0.05%
==========================================
Files 32 32
Lines 4495 4495
Branches 739 739
==========================================
- Hits 3467 3465 -2
- Misses 726 728 +2
Partials 302 302 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jpbrodrick89
force-pushed
the
jpb/fix-click-dep
branch
from
May 27, 2026 09:53
e11b531 to
25b6a33
Compare
`cli.py:run_container` previously declared its context parameter as
`click.Context`, which failed at typer command registration on
`typer >= 0.16`:
RuntimeError: Type not yet supported: <class 'click.core.Context'>
Annotating as `typer.Context` (a thin subclass of `click.Context`) gets
past typer's resolver but trips typeguard at call time, because the
context object click actually injects at runtime is a plain
`click.Context`, not an instance of the `typer.Context` subclass:
typeguard.TypeCheckError: argument "context" (click.core.Context)
is not an instance of typer.models.Context
The context was only used to invoke `context.get_help()` in two
branches. Drop the parameter entirely and look the context up via
`click.get_current_context()` at the point of use, which avoids both
the typer parameter-type check and the typeguard runtime check.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jpbrodrick89
force-pushed
the
jpb/fix-click-dep
branch
from
May 27, 2026 09:58
25b6a33 to
07bffda
Compare
Contributor
Benchmark ResultsBenchmarks use a no-op Tesseract to measure pure framework overhead. 🚀 3 faster, Notable changes
Full results
|
dionhaefner
enabled auto-merge (squash)
May 27, 2026 12:00
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
The
Test pip install (ubuntu-latest, 3.14, latest)CI job has been failing onmain(e.g. https://github.com/pasteurlabs/tesseract-core/actions/runs/26502477818/job/78046217060). Two related issues, both exposed by newertyper/ a base-only install:1.
ModuleNotFoundError: No module named 'click'tesseract_core/sdk/cli.pydoesimport clickunconditionally and the SDK CLI is exposed via[project.scripts], soclickmust be in the base install — not only in theruntimeextra. Until now it was pulled in as a transitive dependency oftyper, but newertyperreleases (>= 0.16ish) no longer guarantee this, sopip install tesseract-corewith the latest dep set fails at CLI import.2.
RuntimeError: Type not yet supported: <class 'click.core.Context'>(then typeguard hit too)Once
clickis installed, a second latent issue surfaces incli.py:run_container. It declared its context parameter asclick.Context, which fails at typer command registration ontyper >= 0.16. Annotating astyper.Context(a thin subclass ofclick.Context) gets past typer's resolver but then trips typeguard at call time, because the context object click actually injects at runtime is a plainclick.Context, not an instance of thetyper.Contextsubclass:The context was only used to invoke
context.get_help()in two branches. Drop the parameter entirely and look the context up viaclick.get_current_context()at the point of use, which avoids both the typer parameter-type check and the typeguard runtime check.Commits
clickto base install dependencies— declareclickas a real dependency. Pre-commit hooks regenerateproduction.uv.lock/requirements.txt; lockfile churn is mostly cosmetic (the pinneduv 0.6.11` in the hook re-serialises every entry).click.Contextparameter fromrun_container— remove the offending parameter fromrun_container's signature; replacecontext.get_help()withclick.get_current_context().get_help()at the two call sites.Test plan
Test pip install (latest)— should clear theModuleNotFoundError.tesseract --help/tesseract run --helpstill work locally.tesseract run(no args) still surfaces the sameBadParametererrors via typer's existing error rendering.🤖 Generated with Claude Code