Skip to content

fix(cli): avoid click<8.2 incompatibility in progressbar hidden kwarg - #407

Merged
Alberto-Codes merged 2 commits into
mainfrom
fix/cli-progressbar-click-compat
May 8, 2026
Merged

fix(cli): avoid click<8.2 incompatibility in progressbar hidden kwarg#407
Alberto-Codes merged 2 commits into
mainfrom
fix/cli-progressbar-click-compat

Conversation

@Alberto-Codes

Copy link
Copy Markdown
Owner

Users with click < 8.2.0 get TypeError: progressbar() got an unexpected keyword argument 'hidden' when running any docvet command. typer.progressbar() accepts hidden in its own signature but passes it through to click.progressbar(), which only added hidden in click 8.2.0. Since docvet declares typer>=0.9 (allowing click>=8.0.0), environments can resolve to click 8.0.x/8.1.x where the kwarg doesn't exist.

  • Add _maybe_progressbar context manager that shows a real progress bar when show=True and yields a plain iterator when show=False, avoiding the hidden kwarg entirely
  • Replace all 5 typer.progressbar(..., hidden=not show_progress) calls in _runners.py with _maybe_progressbar
  • Update tests to mock _maybe_progressbar instead of typer.progressbar, add direct unit tests for the helper

Test: uv run pytest tests/unit/test_cli_progress.py -v

Closes #404


PR Review

Checklist

  • Self-reviewed my code
  • Tests pass (uv run pytest)
  • Lint passes (uv run ruff check .)
  • Types pass (uv run ty check)
  • Breaking changes use ! in title and BREAKING CHANGE: in body

Review Focus

The _maybe_progressbar helper — confirms it correctly delegates to typer.progressbar only when show=True and never passes hidden.

Related

@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Replace direct typer.progressbar(hidden=...) calls with a _maybe_progressbar
helper that skips the progress bar entirely when hidden. The hidden kwarg was
added in click 8.2.0 but typer allows click>=8.0.0, causing TypeError for
users with older click versions.

Closes #404
Pygments was bumped to 2.20.0 (GHSA-5239-wwwm-4pmq fixed), so the
uv-secure ignore entry is now unused.
@Alberto-Codes
Alberto-Codes force-pushed the fix/cli-progressbar-click-compat branch from 02f8f05 to 4b8dd83 Compare May 8, 2026 21:10
@Alberto-Codes
Alberto-Codes marked this pull request as ready for review May 8, 2026 21:12
Copilot AI review requested due to automatic review settings May 8, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a CLI runtime crash in environments using click<8.2 by avoiding the unsupported hidden kwarg path when constructing progress bars via Typer.

Changes:

  • Introduces _maybe_progressbar context manager to either show a real progress bar (show=True) or yield a plain iterator (show=False).
  • Replaces all runner usages of typer.progressbar(..., hidden=...) with _maybe_progressbar(..., show=...) to preserve compatibility.
  • Updates and extends unit tests to mock _maybe_progressbar and to directly test the helper’s behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/docvet/cli/_runners.py Adds _maybe_progressbar and routes runner progress display through it to avoid click<8.2 incompatibility.
tests/unit/test_cli_progress.py Switches progress-bar mocking to _maybe_progressbar and adds focused unit tests for the helper.
pyproject.toml Clears uv-secure vulnerability ignore list (removes prior suppression entry).

@Alberto-Codes
Alberto-Codes merged commit 00dbb82 into main May 8, 2026
16 checks passed
@Alberto-Codes
Alberto-Codes deleted the fix/cli-progressbar-click-compat branch May 8, 2026 21:16
Alberto-Codes added a commit that referenced this pull request May 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.15.1](v1.15.0...v1.15.1)
(2026-05-08)


### Bug Fixes

* **cli:** avoid click&lt;8.2 incompatibility in progressbar hidden
kwarg ([#407](#407))
([00dbb82](00dbb82)),
closes [#404](#404)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

fix(cli): typer.progressbar() fails with click < 8.2 due to unsupported 'hidden' kwarg

2 participants