jorenham / mainpy

Simplify your project's main entrypoint definition with @main
https://pypi.org/project/mainpy/
MIT License
7 stars 2 forks source link

`Any` error when using with click #41

Closed DetachHead closed 2 months ago

DetachHead commented 2 months ago

thanks for fixing #36 so quickly

i noticed that both basedpyright and basedmypy report the function as containing Any when using the main decorator with click

import click
from mainpy import main

@main # basedpyright error: Function decorator obscures type of function because its type is Any (reportAny)
@click.command()
def click_command(): # basedmypy error: no-any-decorated
    print("Hello from click_command")

basedpyright 1.17.1 basedmypy 2.6.0

DetachHead commented 2 months ago

oh wait, this is an issue with click:

import click

@click.command()
def click_command():
    print("Hello from click_command")

if __name__ == "__main__":
    reveal_type(click_command())  # Any
jorenham commented 2 months ago

If you wanna have nice annotations, then I could recommend Typer instead, which builds upon click.