jorenham / mainpy

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

doesn't work with click #36

Closed DetachHead closed 2 months ago

DetachHead commented 2 months ago

this example from the docs doesn't seem to work

import mainpy
import click

@mainpy.main
@click.command()
def click_command():
    click.echo('Hello from click_command') # never runs
python foo.py

mainpy v1.3.2 click v8.1.7 python v3.12

jorenham commented 2 months ago

This was caused by a bug in click.core.Command that doesn't call functools.update_wrapper (unlike click.core.Group), so that the wrapped function's __module__ is "overwritten" with "click.core".