Entry Points In Setup.py
I am making a CLI in python using Click. This is my entry point script: entry_points='''     [console_scripts]     noo=noo.noodle:downloader ''',  I have made a Package, I have add
Solution 1:
Directly from the documentation on click.pocoo.org:
yourscript.py:
import click
@click.command()defcli():
    """Example script."""
    click.echo('Hello World!')
setup.py:
from setuptools import setup
setup(
    name='yourscript',
    version='0.1',
    py_modules=['yourscript'],
    install_requires=[
        'Click',
    ],
    entry_points='''
        [console_scripts]
        yourscript=yourscript:cli
    ''',
)
While if you have multiple commands in your CLI application, I usually create a click group like this:
init.py:
import click
@click.group()@click.option('--debug/--no-debug', default=False, help='My test option.')defcli(debug):
    """Add some initialisation code to log accordingly for debugging purposes or no"""pass@cli.command()defconfigure():
    """Configure the application"""passAnd the setup.py file looks exactly the same as the one in the click documentation.
Post a Comment for "Entry Points In Setup.py"