Repository navigation
Description
Filed by the maintainer's conductor agent (automated). Reproduced on the head of #1604 (63d61235, which is dev f0b010ad plus the #1597 fix) in a fresh environment with Typer 0.29.1. Written so someone new to Pyrite can take it from this issue alone.
What happens
pyproject.toml allows any Typer from 0.12.3 up; the lock (and so CI) installs 0.27.3. After #1597 is fixed, the command lines run on Typer 0.29.1, but one test file does not:
$ pytest tests/test_cli_numeric_options_declare_a_range.py -n0 -q # Typer 0.29.1
33 failed, 5 passed
- 28 ×
AttributeError: 'TyperOption' object has no attribute 'type'. The checker's helpers readparam.type(lines 182, 213, 214, 542, 669, 717). In Typer 0.29.1,typer.core.TyperOptionhas notype; the attributes it does have that mention a type arebare_type,_bare_type,display_type,display_type_richandparam_type_name. - 5 ×
TypeError: Option() got an unexpected keyword argument 'click_type'. These are apps the test file plants itself (for exampletest_planted_typer_parser_or_click_type_cannot_be_classified[click_type=INT]). Typer 0.29 removed the keyword.
On Typer 0.27.3 the same file passes (38 tests).
No production code is involved: nothing under pyrite/ or extensions/ reads param.type (grep), and the commands themselves run on 0.29.1.
Why it matters
- This file is the ratchet for Every numeric CLI option declares its range, and a test says so #1541 (every numeric CLI option declares its range). On Typer 0.29 it checks nothing, so the day the lock moves to 0.29 the ratchet is gone, and with it the test every per-option range pull request relies on.
.github/workflows/unlocked.ymlruns the suite on the newest allowed versions every Monday. Its next run will show these 33 failures.
Reproduce
uv venv /tmp/t029 && uv pip install --python /tmp/t029/bin/python -e ".[cli,dev]" "typer==0.29.1"
for e in extensions/*/; do uv pip install --python /tmp/t029/bin/python -e "$e"; done
/tmp/t029/bin/python -m pytest tests/test_cli_numeric_options_declare_a_range.py -n0 -q
(Do this in a throwaway environment; do not change uv.lock or the repo's .venv.)
Invariant
The range checker classifies every command-line parameter (numeric and bounded, numeric and unbounded, not numeric, or cannot tell) on every Typer version pyproject.toml allows, and its planted controls go red on each of them.
Not yet groomed: one question is open
What does Typer 0.29 expose that says "this parameter is an int or a float, with this min and max"? The fix depends on the answer:
- (a) if
bare_typeplus the option'smin/maxcarry it, the helpers read the number type and the range through one small function that works on both versions, and the plantedclick_type=cases run only where the keyword exists (they pin a Typer 0.27 behaviour); - (b) if 0.29 does not expose the range at all, say so in the test's docstring as a stated limit and decide whether the lock, or the allowed range in
pyproject.toml, stays below 0.29 until it does.
A first step that needs no decision: print vars(param) for one bounded and one unbounded numeric option on 0.27.3 and on 0.29.1 and put both in a comment here.
Acceptance (once the question is answered)
- On Typer 0.27.3 and on 0.29.1: tests/test_cli_numeric_options_declare_a_range.py passes, with the same number of
parameters classified on both (print the counts in the pull request).
- A planted unbounded numeric option is reported on both versions (the planted tests are red without the checker).
- No `skip` that hides the whole file on a Typer version.
Out of scope: moving the lock to Typer 0.29; a CI job on the newest Typer (unlocked.yml already runs weekly).
Found while reviewing #1604 (the worker's report lists it under "Left"); related: #1597, #1541.
Activity
markramm commentedon Nov 17, 2026
Automated groom by the maintainer's conductor agent.
Groom 2026-11-17
Model. The user's model: "the ratchet for #1541 goes red when I add a numeric CLI option with no range, whichever Typer I have". The implementation model: the checker reads one thing from each click parameter (its value type) and judges it by class name and by calling the type's own
convert; the only version-dependent step is how it gets that type from a parameter. Today it assumesparam.typeexists. On Typer 0.29.1 it does not, so the ratchet checks nothing there (33 of 38 tests error).1. Contracts that apply
kb/design.md, principle "a test that cannot fail guards nothing": the ratchet must stay red for a planted unbounded option on every Typer thepyproject.tomlrange allows (0.12.3 and up; lock and CI use 0.27.3).tests/test_cli_numeric_options_declare_a_range.py, top): the check is behavioural, not an attribute scan.click_type=;tests/test_cli_import_typer_keywords.pyis the pattern for pinning a version difference without installing two Typers (it reads source withast)..github/workflows/unlocked.ymlruns the suite on the newest allowed versions every Monday; that is the only CI that sees 0.29 and it is not a gate.2. What the code does today (dev d4fcea8)
Everything version-dependent is in one file,
tests/test_cli_numeric_options_declare_a_range.py:numeric_paramsline 182:_numeric_members(param.type).unclassified_paramslines 213-214:_members(param.type)andtype(param.type).__name__.test_count_option_is_excluded...line 531:getattr(param.type, "min", None).test_typer_gives_a_func_param_type...line 658 (p.type) and the test near line 704-706 (.typethenconvert).typer.Option(..., click_type=...)at lines 633-635 and 650; Typer 0.29 raisesTypeError: Option() got an unexpected keyword argument 'click_type'. These pin 0.27 behaviour (FuncParamType forparser=/click_type=).parser=int(line 625) still exists in 0.29.No production file reads
param.type(issue says grep found none; unchecked by me).Reproduce (throwaway env, do not touch the repo
.venv): the commands in the issue body. Result on 0.29.1:33 failed, 5 passed; on 0.27.3: 38 pass. I did not run it; the counts are the issue's.3. Invariant and surfaces
Invariant: the checker classifies every parameter (numeric bounded, numeric unbounded, not numeric, cannot tell) on every Typer version the project allows, and its planted controls are red on each.
registry()); the version-dependent reads are the six.typesites above, found bygrep -n '\.type\b\|click_type\|bare_type'on the file.Shapes (counted by that grep): 6 reads of
param.type; 5 planted parametrizations/apps usingclick_type=(lines 626, 633-635, 650, one test id each); 1 hard-coded FuncParamType pin.4. Options
A. One adapter,
_value_type(param), that returnsparam.typewhere present and otherwise the equivalent from 0.29, and replace the six reads. Run theclick_type=plants only wheretyper.Optionaccepts the keyword (check withinspect.signature), and add aparser=plant that runs on both. Smallest change; keeps the behavioural check.B. Cap Typer below 0.29 in
pyproject.toml. Contradicts #1597 (the CLI now imports on 0.29) and hides the next break. Not recommended.C. Rebuild the checker on Typer's own
typer.mainintrospection instead of click params. Larger; no evidence it is needed.Recommendation: A.
5. Open questions (worker: overturn with evidence)
TyperOptiongive for the number type and bounds? The issue listsbare_type,display_type,param_type_namebut notype. If 0.29 builds the click type lazily (a method, such asget_type()or a conversion done at parse time), the adapter calls that. If it exposes no range at all, option A fails: then state it in the docstring as a stated limit and ask the maintainer whether the allowed range stays below 0.29 (that is a decision; stop and ask).vars(param)of one bounded and one unbounded numeric option on 0.27.3 and on 0.29.1 and paste both in a comment here._refuses(callsconvert(value, None, None)) still work if the type object differs in 0.29?6. Pointers
tests/test_cli_import_typer_keywords.py(reads source withast, no second Typer needed).tests/test_cli_numeric_options_declare_a_range.py(checker and plants)..github/workflows/unlocked.yml.7. Checked versus assumed
Checked by reading: the six
.typesites, the fiveclick_type=plants, the diff of #1604 (it touched only the docstring lines of this test, 10 lines) and the diff of open draft PR #1614. Assumed: the issue's 33/5 counts and what 0.29 exposes (not run: no 0.29 environment here). This groom is wrong if 0.29TyperOptionoffers no way to recover the number type and range.Predicted footprint: 1 existing file, about 40 to 80 changed lines, no new file. No production code.
Spike? No, but the first step in section 5 is mandatory and must precede any edit.
Dispatch
How a contributor proves it without two Typers in CI: unit-test the adapter with a small fake parameter that has
.typeand one that has only the 0.29 attributes, so both branches run on the locked Typer; run the file once by hand in a 0.29.1 virtualenv and paste the counts; the Mondayunlocked.ymlrun is the standing check.