Search code examples
linuxpypipython-3.5

Pypi package : where is my executable?


(Archlinux/Python3.5)

I'm working on a small Python3 project made up of only one Python file . With the help of tutorials like this one, I've created a Pypi package with the following commands :

$ python setup.py sdist bdist_wheel register -r pypi   (ok, no error msg)
$ python setup.py sdist bdist_wheel upload -r pypi     (ok, no error msg)

... and I thought I would juste have to write :

$ sudo pip install katal    (ok, no error msg)

and then, e.g. :

$ katal --version

... in order to use it.

But the last command fails : there's no katal or Katal command; if I take a look at /usr/lib/Python3.5/site-packages/ , I only see the following files (no .py file have been installed !) :

  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/DESCRIPTION.rst
  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/METADATA
  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/RECORD
  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/WHEEL
  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/metadata.json
  /usr/lib/python3.5/site-packages/Katal-0.0.9.dist-info/top_level.txt

I've obviously forgotten something... But what ? My setup.py clearly defines where is the unique package of my project (=take everything but the test directory, including the katal sub-directory) :

 packages=find_packages(exclude=['tests*']),

Any help would be appreciated !


Solution

  • in your setup.py, there is a section which is commented out:

    ...
    ##entry_points={
    ##    'console_scripts': [
    ##        'sample=sample:main',
    ##    ],
    ##
    ...
    

    This is where I would normally define an executable, please see this tutorial. You can also define a scripts argument to setup which works a little differently (and might match your use case a little better), but that is covered in the tutorial I linked to.