43

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?

1

1 Answer 1

38

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',
        ],
    }
)
Sign up to request clarification or add additional context in comments.

2 Comments

When I try this with Python 2.6 and 3.1, I get a message UserWarning: Unknown distribution option: 'entry_points'. So I guess it's not supported in the distutils that comes with Python (2.6 and 3.1). So, is it okay to use this option if we want to distribute on PyPI?
on Ubuntu 11.04, install python-setuptools. Make sure you setup.py is importing: 'from setuptools import setup'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.