Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to distribute python command-line tools?

My current setup.py script works okay, but it installs tvnamer.py (the tool) as tvnamer.py into site-packages or somewhere similar..

Can I make setup.py install tvnamer.py as tvnamer, and/or is there a better way of installing command-line applications?

like image 741
dbr Avatar asked Aug 20 '08 13:08

dbr


People also ask

What are command line tools in Python?

The command line interface (also known as CLI) is a means to interact with a command line script. Python comes with several different libraries that allow you to write a command line interface for your scripts, but the standard way for creating a CLI in Python is currently the Python argparse library.


1 Answers

Try the entry_points.console_scripts parameter in the setup() call. As described in the setuptools docs, this should do what I think you want.

To reproduce here:

from setuptools import setup  setup(     # other arguments here...     entry_points = {         'console_scripts': [             'foo = package.module:func',             'bar = othermodule:somefunc',         ],     } ) 
like image 177
Blair Conrad Avatar answered Sep 28 '22 11:09

Blair Conrad