How do I use the command decorator with MyPy strict enabled? #1008
-
First Check
Commit to Help
Example Codeimport typer
from typer import Typer
app: Typer = typer.Typer()
@app.command()
def main() -> None:
print("Hello")
if __name__ == "__main__":
app()DescriptionI ran MyPy in strict mode and it complains about the command decorator: run.py:7: error: Untyped decorator makes function "main" untyped [misc] Is there a way or an example of using the command decorator in a way that keeps MyPy happy? Operating SystemWindows Operating System DetailsWindows 11 version 23H2 Typer Version0.12.5 Python Version3.12.6 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Just ran this code with Typer 0.17.4 and mypy 1.18.1 and got So, I think this has been fixed |
Beta Was this translation helpful? Give feedback.
-
|
I'd forgotten about this question... yeah don't think I'd noticed it lately. |
Beta Was this translation helpful? Give feedback.
Just ran this code with Typer 0.17.4 and mypy 1.18.1 and got
Success: no issues found in 1 source file.So, I think this has been fixed