Skip to content

Support typer 0.26+, which builds on its own copy of click - #570

Merged
holmboe merged 2 commits into
mainfrom
fix/typer-0.26-click-layer
Oct 8, 2026
Merged

holmboe merged 2 commits into
mainfrom
fix/typer-0.26-click-layer

Conversation

@holmboe

@holmboe holmboe commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Lock file maintenance (#534) moves typer from 0.25.1 to 0.27.2 and fails 71 tests. Swapping one package at a time shows typer alone is the cause: click 8.5 with typer 0.25.1 passes everything.

From 0.26, typer builds on its own copy of click, typer._click, so anything phabfive or its tests take from the click package no longer matches what typer hands back.

A real bug: create --with (e0a2f67)

options_given in phabfive/cli/create_spec.py compared the parameter source against click.core.ParameterSource.DEFAULT. typer's context returns its own enum, so the identity check never matched, every option counted as given, and maniphest create --with refused every spec. pyproject.toml allows typer>=0.12.0, so anyone who installs from PyPI today gets typer 0.27 and hits this. The check now compares by name, which works on both.

The tests (7ed1a3f)

The completion tests used click's completion registry, which typer no longer fills, and click's ShellComplete. typer's copy of ShellComplete is abstract. The comment-editor tests patched the stdin wrapper in click.testing, which typer's CliRunner no longer uses. tests/click_layer.py picks whichever click typer is using. The two spec-file completer tests now take their context from the real command, so they don't need the helper.

Verified

  • uv run pytest with the current lock (typer 0.25.1, click 8.3.1): 5971 passed
  • the same with chore(deps): lock file maintenance #534's uv.lock (typer 0.27.2, click 8.5.0): 5971 passed
  • ruff and mypy are clean

When this merges, Renovate should rebase #534 and it should go green.

Fixes #330

🤖 Generated with Claude Code

holmboe and others added 2 commits October 8, 2026 13:54
From typer 0.26 the context is typer's own copy of click, so its
ParameterSource is a different enum from click.core.ParameterSource. The
identity check never matched DEFAULT, every option counted as given, and
`maniphest create --with` refused any spec. Compare by name instead, which
holds for both.

Refs #330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
typer 0.26 builds on its own copy of click, so the tests that reached for
the click package found an empty completion registry, an abstract
ShellComplete and a CliRunner stdin they could not patch. tests/click_layer.py
picks whichever click typer is using, so the suite passes on the locked
typer and on 0.27, which lock file maintenance (#534) moves to.

Fixes #330

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adapts CLI tests and code to support typer 0.26 with bundled click.

This PR appears safe to merge; no actionable issues were found.

What we checked:

  • Spec completion still checks files: complete_spec_file takes only the incomplete path. Both tests still call the real option and check exact file and directory names.

Summary

This PR fixes options_given for Typer versions that carry their own Click copy.

  • It compares parameter sources by name instead of comparing enum objects from different packages.
  • Completion tests select Typer's completion classes and use contexts from real commands.
  • Comment-editor tests patch the stdin wrapper used by Typer's runner.
  • No actionable issues were found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "test: drive completion through the click..." · Reviewed by Greptile

@holmboe
holmboe merged commit 93c9d06 into main Oct 8, 2026
28 checks passed
@holmboe
holmboe deleted the fix/typer-0.26-click-layer branch October 8, 2026 12:02
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.

typer 0.26 breaks the completion and skill tests: TyperGroup is no longer a click.Group

1 participant