python - Entry Points in setup.py -
i making cli in python using click. entry point script:
entry_points=''' [console_scripts] noo=noo.noodle:downloader ''', i have made package, have added import noodle in __init__.py file import file noodle contains function downloader() - needs executed entry_point script. when install setup.py, error: importerror: no module named noo.noodle when run noodle --help in terminal?
directly documentation on click.pocoo.org:
yourscript.py:
import click @click.command() def cli(): """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 have multiple commands in cli application, create click group this:
__init__.py
import click @click.group() @click.option('--debug/--no-debug', default=false, help='my test option.') def cli(debug): """add initialisation code log accordingly debugging purposes or no""" pass @cli.command() def configure(): """configure application""" pass and setup.py file looks same 1 in click documentation.
Comments
Post a Comment