Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

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?

question from:https://stackoverflow.com/questions/17893/whats-the-best-way-to-distribute-python-command-line-tools

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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',
        ],
    }
)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...