Python's setuptool has two ways of adding command line scripts to a Python package: script and entry_point.
This tutorial outlines these ways:
scripts
Add a Python script (funniest-joke) to the package tree, and add its path to setup.py:
setup(
...
scripts=['bin/funniest-joke'],
...
)
Entry point:
Add a Python script (funniest-joke) to the package tree. Add a main() function to it, and add command_line.py submodule which runs funniest's main():
command_line.py:
import funniest
def main():
print funniest.joke()
setup.py
setup(
...
entry_points = {
'console_scripts': ['funniest-joke=funniest.command_line:main'],
}
...
)
What are the advantages and disadvantages of each method?