Skip to content

build(deps): move Typer to 0.29 and its Pydantic parameters #5097

Not planned

Description

@dan-petty

Problem or Motivation

pyproject.toml pins typer; the baseline (#5065) moves it to 0.28.0. The newest is 0.29.1. Renovate (#4893) will offer it, and it needs work:

  • 0.29.0: "Typer now uses Pydantic internally to validate command-line parameters". click_type is removed. Callback parameter objects no longer expose Click's .type, .make_metavar(), .human_readable_name and .type_cast_value(). Help and usage output changed.
  • Code that reads param.type: src/devops_cli/docs/generator.py:296, src/devops_cli/ai/mcp/generator.py:234-236,274-281,342, src/devops_cli/roadmap/stage/stage_run_allowlist.py:29-30,151 (it imports typer._click.types.File and typer.models.TyperPath, both gone; mypy gives import-not-found and attr-defined).
  • 172 test IDs fail on 0.29.1 ("'TyperOption' object has no attribute 'type'", and ImportError on typer._click.types): MCP tool generation, the docs generator, and every CLI test that builds the MCP or docs tree.

Research of 2026-11-12 (research-python, migration typer).

Proposed Solution & Architectural Design

  • Read the parameter types through the public Typer 0.29 API (or the Click command that Typer builds) in the docs generator, the MCP generator and the stage allowlist.
  • Generate the command reference again (devops docs) for the changed help and usage output.
  • Pin typer 0.29.1 and run the full test suite.

Done when the 172 tests pass on 0.29.1 and the generated documents are current.

Target Subsystem

FastMCP & IDE Integrations

Existing Tool Considered

Typer and Click public APIs. No new code beyond the generator fixes.

Source: #4893

Alternatives check of 2026-11-22: none.
Tool: none found.
Reason: Searches found no tool or shim that restores Typer 0.28 parameter attributes or rewrites the generators; Typer and Click are the dependency and its API, so the migration stays project work.

Lacks:

  • No shim restoring removed Typer 0.28 callback parameter attributes
  • No automated rewrite of docs, MCP generator and stage allowlist
  • No tool regenerates the command reference or runs the suite

Proposed design

Problem statement

Typer 0.29.1 validates command-line parameters with Pydantic. It removes click_type, the Click attributes on callback parameter objects, and the private Typer imports that the docs generator, the MCP generator and the stage allowlist use. The project must migrate those readers to public Typer or Click APIs, regenerate the command reference and pin typer 0.29.1. The change is done when the 172 failing tests pass and the generated documents are current.

Acceptance criteria

Requirement: MCP parameter introspection

The MCP tool generator SHALL read command parameter types through the public Typer or Click API on Typer 0.29.1.

Scenario: MCP generation on Typer 0.29.1

  • WHEN uv run pytest tests/ai/mcp runs under typer 0.29.1
  • THEN the command exits 0 and no test raises AttributeError for 'TyperOption' object has no attribute 'type'.

Requirement: Docs parameter introspection

The docs generator SHALL derive command parameter types from the public Typer or Click API on Typer 0.29.1.

Scenario: Docs generator tests on Typer 0.29.1

  • WHEN uv run pytest tests/test_docs.py runs under typer 0.29.1
  • THEN the command exits 0 and the generator produces the command reference with no removed Click attribute access.

Requirement: Stage allowlist public imports

The stage allowlist SHALL use public Click and Typer types and SHALL NOT import removed private Typer modules.

Scenario: Stage allowlist type check

  • WHEN uv run mypy src/devops_cli/roadmap/stage/stage_run_allowlist.py runs under typer 0.29.1
  • THEN the command exits 0 with no import-not-found or attr-defined error.

Requirement: Typer pin

The project SHALL pin typer to 0.29.1 and keep the lockfile consistent.

Scenario: Installed Typer version

  • WHEN uv run python -c "import importlib.metadata; assert importlib.metadata.version('typer') == '0.29.1'" runs after the pin change
  • THEN the command exits 0 and the installed Typer version is 0.29.1.

Requirement: Generated command reference

The generated command reference SHALL match the help and usage output of Typer 0.29.1.

Scenario: Generated docs check

  • WHEN uv run devops ci --check --only docs runs after devops docs regenerates the reference
  • THEN the command exits 0 and reports no generated document drift.

Requirement: Full test suite

The full test suite SHALL pass under typer 0.29.1.

Scenario: Full suite on Typer 0.29.1

  • WHEN uv run pytest runs under typer 0.29.1
  • THEN the command exits 0 and the 172 failing test IDs from the migration no longer fail.

Existing Tool Considered

No open, maintained tool or library covers this migration. The alternatives check of 2026-11-15 found none: no shim restores the removed Typer 0.28 parameter attributes, and no library performs the generator fixes. Typer is the dependency to bump, and Click's public Parameter API is the route to the parameter types. The project builds no replacement tool, so no tool-match cost applies. The bounded cost is the three generator fixes, one document regeneration and one full test run.

Key questions

  • Which API replaces the removed Click attributes on Typer 0.29 callback parameter objects?: Read the Click command that Typer builds. Use the public click.Parameter attributes on click.Command.params, such as type, opts, secondary_opts, is_flag, multiple and nargs. Do not read the Typer callback parameter objects. (best practice) [sources: src/devops_cli/ai/mcp/generator.py]
    • Chosen: Click command public API. Typer 0.29 still builds Click commands. The existing resolve_click_command already returns the Click command. Public Click attributes keep the parameter data.
    • Rejected: Typer Pydantic model internals. The model is private and undocumented. It can change without notice.
    • Rejected: Pin Typer 0.28. The item asks for 0.29.1. The baseline already uses 0.28.0.
  • How does the stage allowlist identify file and path parameters after Typer removes typer._click.types.File and typer.models.TyperPath?: Use the public Click parameter type on the resolved Click command, such as click.File or click.Path, and use pathlib.Path for path values. Remove the private Typer imports. (best practice) [sources: src/devops_cli/roadmap/stage/stage_run_allowlist.py:29]
    • Chosen: Public Click types. click.File and click.Path are public and stable. The resolved Click command exposes them.
    • Rejected: Private Typer modules. Typer 0.29 removes the modules. The import fails and mypy reports import-not-found.
    • Rejected: String match on type name. A name match is brittle and misses subclasses.
  • Which source files need the parameter API migration?: The docs generator, the MCP generator and the stage allowlist need the migration. The MCP generator reads param.type in _deduce_parameter_type, _build_parameter_field and _append_option_tokens. The docs generator reads param.type at line 296. The stage allowlist imports the removed private types at lines 29-30 and uses them at line 151. [sources: src/devops_cli/docs/generator.py:296, src/devops_cli/ai/mcp/generator.py, src/devops_cli/roadmap/stage/stage_run_allowlist.py:29]
  • Should the project pin typer exactly or allow a range?: Pin typer to exactly 0.29.1. The project pins exact versions in pyproject.toml, and Renovate manages the update. (best practice) [sources: pyproject.toml]
    • Chosen: Exact pin 0.29.1. The project uses exact pins for dependencies. Renovate opens the next update.
    • Rejected: Range >=0.29,<0.30. A range hides a new release from review and differs from the project convention.
  • Should the generated command reference be regenerated in this change?: Yes. Run devops docs and commit the regenerated command reference. The help and usage output changed on Typer 0.29.1. (best practice) [sources: docs/CLI_REFERENCE.md, src/devops_cli/docs/generator.py]
    • Chosen: Regenerate the reference. The generated document must match its generator output. The docs check refuses drift.
    • Rejected: Leave the reference stale. The docs check fails and the reference shows old help and usage.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/infra
    scope/deps
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches surfaced no library that performs the Typer 0.29 parameter-API migration or that restores the removed click_type / TyperOption.type surface; the only relevant packages are Typer itself (the dependency to bump) and Click, whose public API the issue already names as the route to the parameter types. So the generator fixes, the failing tests and the document regeneration stay project work rather than being covered by a separate tool.

    Tool: none found

    Lacks:

    • A shim or library that keeps the removed Typer 0.28 parameter attributes (click_type, .type, .make_metavar(), .human_readable_name, .type_cast_value()) working on 0.29
    • The fixes in the docs generator, the MCP generator and the stage allowlist that read parameter types
    • The regeneration of the command reference for the changed help and usage output

    Tools considered:

    Searches run:

    • Typer 0.29 click_type removed parameter type migration, results: 5
    • Typer 0.29 Pydantic parameter validation TyperOption .type attribute, results: 5
    • python cli framework parameter introspection library click typer compatibility, results: 5
    • typer fastapi tiangolo github releases, results: 5
    • TyperOption pydantic, results: 5
    • typer.tiangolo.com, results: 5
    • click pallets python, results: 5
    • typer, results: 5

    Sources:

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

  6. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at c58b592 (see proposed design in issue body).

  8. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Closed: the move is done.

    pyproject.toml pins typer==0.29.3 (#6833, #7287), and src/ no longer imports the names that 0.29 removed.

  9. removed
    status/ready
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/depssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions