Python package callable from the shell?
Question: I have a tool written in Python which I would like to turn into a Python
package, to make it easier to install dependencies and distribute it.

There are two usages:

  1. you import the module `mytool.py`, call the wrapper function on it, a summary of some measurements is printed on screen and you obtain a dictionary with the full results. `import mytool; results = mytool.mytool(param1=1, param2=2)`
  2. You call `mytool.py` from a shell, with the same parameters as above and a summary of the measurements is printed on screen. `$ python mytool.py --param1 1 --param2 2`

Would this be correct? I understand that when you install a package from
`pypi`, the main usage is the one in point 1. Once installed, It could be
cumbersome to go find the exact path to `mytool.py`, and call it from the
shell. Is there an alternative?


Answer: I think is fine, just make sure in your setup.py you specify a nice path to
store the script playing a bit with the disutils lib

    
    
    from distutils import setup
    setup(
        ...,
        scripts=['path/to/your/script',],
        ...
    )
    

Some nice info can be found here
<https://docs.python.org/2/distutils/index.html#distutils-index>

<https://docs.python.org/2/distutils/packageindex.html>

