-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
<nothing> not callable
error in Mypy with Click 8.1.0
#2227
Comments
Happy to consider a PR that adjusts the type annotations. |
Looking at the code (https://github.com/pallets/click/blob/main/src/click/core.py#L1814), it appears to have been changed to a Union while adding support for not calling the decorator before the function. As per the mypy documentation, this should be represented with overloads, rather than a union: |
It broke decorator typing: pallets/click#2227
It broke decorator typing: pallets/click#2227
I think this is the same problem: This MWE: import click
@click.group()
def main() -> None:
pass
@main.command()
def tree() -> None:
pass Run with this noxfile: import nox
@nox.session
@nox.parametrize("click", ["8.0.4", "8.1.0"])
def mypy(session: nox.session, click: str) -> None:
session.install("mypy==0.942", f"click=={click}")
session.run("mypy", "--strict", "example.py") Produces: $ nox
nox > Running session mypy(click='8.0.4')
nox > Creating virtual environment (virtualenv) using python3.10 in .nox/mypy-click-8-0-4
nox > python -m pip install mypy==0.942 click==8.0.4
nox > mypy --strict example.py
Success: no issues found in 1 source file
nox > Session mypy(click='8.0.4') was successful.
nox > Running session mypy(click='8.1.0')
nox > Creating virtual environment (virtualenv) using python3.10 in .nox/mypy-click-8-1-0
nox > python -m pip install mypy==0.942 click==8.1.0
nox > mypy --strict example.py
example.py:7: error: Untyped decorator makes function "tree" untyped
Found 1 error in 1 file (checked 1 source file)
nox > Command mypy --strict example.py failed with exit code 1
nox > Session mypy(click='8.1.0') failed.
nox > Ran multiple sessions:
nox > * mypy(click='8.0.4'): success
nox > * mypy(click='8.1.0'): failed I'm guessing this was broken by #2212? |
I am wondering if similar type annotations need to be added to |
Click 8.1.1 is now available: https://pypi.org/project/click/8.1.1/ |
Click 8.1.1 was released with a fix for pallets/click#2227.
Click 8.1.1 was released with a fix for pallets/click#2227.
Run
This used to pass with Click 8.0.4
Environment:
The text was updated successfully, but these errors were encountered: