Skip to content

fix: pin click to <8.2.0 to fix typer compatibility (fastapi/typer#1225)#5

Merged
uglide merged 2 commits intomainfrom
fix/pin-click-version
May 20, 2025
Merged

fix: pin click to <8.2.0 to fix typer compatibility (fastapi/typer#1225)#5
uglide merged 2 commits intomainfrom
fix/pin-click-version

Conversation

@kiryazovi-redis
Copy link
Copy Markdown
Contributor

Bug: TypeError when showing help with Typer 0.12.5 + Click 8.2.0 on Python 3.13.3

Description

When running a Typer application on Python 3.13.3 with Typer 0.12.5 and Click 8.2.0, calling cli().help() or using the rich help formatter results in the following error:

TypeError: Parameter.make_metavar() missing 1 required positional argument: 'ctx'

Steps to Reproduce

  1. Install Python 3.13.3
  2. Install Typer 0.12.5 (pip install typer==0.12.5)
  3. Run the following minimal example:
import typer

cli = typer.Typer()

@cli.command()
def hello():
    """Say hello"""
    print("Hello!")

if __name__ == "__main__":
    cli().help()

Error Traceback

TypeError: Parameter.make_metavar() missing 1 required positional argument: 'ctx'

The error occurs in typer/rich_utils.py in the _print_options_panel function, which calls Parameter.make_metavar() without providing a context argument.

Environment

  • Python 3.13.3
  • Typer 0.12.5
  • Click 8.2.0

This issue is seen in CI:

https://github.com/redis-developer/cae-client-testing/actions/workflows/deploy-self-hosted-runner.yml
Has started failing.
https://github.com/redis-developer/cae-client-testing/actions/runs/15118951240/job/42496572577
green run:
https://github.com/redis-developer/cae-client-testing/actions/runs/14939844759/job/41975035756

After trying to code a workaround I realised that typer developers themselves have pined the wheel.
fastapi/typer#1225

So proposing this fix for the time being.

Tested locally with the new wheels.

@kiryazovi-redis kiryazovi-redis requested a review from uglide May 20, 2025 14:25
Comment thread pyproject.toml Outdated
[tool.poetry.dependencies]
python = "^3.11"
typer = "^0.12.3"
click = "<8.2.0"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's pin the typer instead to 0.15.4

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I pinned it

@kiryazovi-redis kiryazovi-redis requested a review from uglide May 20, 2025 14:52
@uglide uglide merged commit c6c4970 into main May 20, 2025
@kiryazovi-redis kiryazovi-redis deleted the fix/pin-click-version branch May 20, 2025 14:55
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.

2 participants