Skip to content

👽️ Ensure compatibility with Click 8.2 #1145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

theMarix
Copy link
Contributor

@theMarix theMarix commented Feb 6, 2025

Creating this as a heads up regarding a compatibility problem with Click 8.2.0. Click changes the signature of the make_metavar and get_metavar functions.

This PR provides compatibility with both older and newer versions of Click by verifying the function signature.

Click also changed behaviour in various ways that are breaking tests even though Typer itself works as expected. The PR so far tackles the trivial cases. However, there are still tests remaining that will need a closer look to ensure compatibility.

Click 8.2 now expects the context to be passed to the make_metavar method. To enable Typer to be used both with new and old versions of Click, this passes the parameter conditionally. For the make_metavar override to stay compatible, pass the parameter through via catchall for
    positional arguments.
@svlandeg svlandeg added bug Something isn't working click Related to Click functionality labels Feb 7, 2025
@theMarix
Copy link
Contributor Author

theMarix commented Feb 7, 2025

I am not sure how much time I'll have to look into those additional failing tests. Anybody feel free to adopt (parts of) this for a proper fix.

@svlandeg svlandeg self-assigned this Feb 7, 2025
@svlandeg svlandeg changed the title Tackle compatibility issues with Click 8.2 👽️ Ensure compatibility with Click 8.2 Feb 20, 2025
@svlandeg
Copy link
Member

Thanks so much for the initial work on this, @theMarix! This will definitely be useful. We'll continue working on your branch directly if that's OK, to get the PR in good shape.

@theMarix
Copy link
Contributor Author

Of course. That's why I submitted in the first place. I sadly don't have the capacity and context knowledge to adopt all the tests in a realistic time. Use as much or as little of my submission as is useful to you and feel free to modify the branch as makes sense.

@svlandeg
Copy link
Member

Click's 8.2 release plan: pallets/click#2789

@bckohan
Copy link
Contributor

bckohan commented May 10, 2025

Click 8.2 is out.

oriori1703 added a commit to oriori1703/sigmatcher that referenced this pull request May 11, 2025
CasperWA added a commit to SINTEF/entities-service that referenced this pull request May 13, 2025
Better error output in test that failed when trying out click v8.2.

See fastapi/typer#1145 to follow support a bit.
CasperWA added a commit to SINTEF/entities-service that referenced this pull request May 13, 2025
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.8 → v0.11.9](astral-sh/ruff-pre-commit@v0.11.8...v0.11.9)

* Avoid click v8.2 - no support for this in typer now

Better error output in test that failed when trying out click v8.2.

See fastapi/typer#1145 to follow support a bit.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Casper Welzel Andersen <[email protected]>
rporres added a commit to rporres/rh-aws-saml-login that referenced this pull request May 13, 2025
8.2.0 has some behaviour changes that makes typer not work properly.

See fastapi/typer#1145

Signed-off-by: Rafa Porres Molina <[email protected]>
Guts added a commit to Guts/DicoGIS that referenced this pull request May 13, 2025
@devinnasar
Copy link

devinnasar commented May 13, 2025

@theMarix, can we promote this to a non-draft PR so it can get some attention? The Click 8.2.0 incompatibility issue is now impacting projects using Typer since it was dropped this week.

@theMarix
Copy link
Contributor Author

@devinnasar , the PR is currently in draft mode because it is not in a mergable state. The code works on 8.2, but not all tests will pass.
As I understood @svlandeg 's initial comment, the maintainers are aware of the PR.

rporres added a commit to rporres/rh-aws-saml-login that referenced this pull request May 14, 2025
8.2.0 has some behaviour changes that makes typer not work properly.

See fastapi/typer#1145

Signed-off-by: Rafa Porres Molina <[email protected]>
grzegorz-roboflow added a commit to roboflow/inference that referenced this pull request May 14, 2025
@theMarix
Copy link
Contributor Author

This has become obsoleted by #1222 .

@theMarix theMarix closed this May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working click Related to Click functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants