分发python命令行工具的最佳方法是什么?
我当前的setup.py
脚本可以正常运行,但是可以将其tvnamer.py
(工具)安装tvnamer.py
到站点程序包中或类似位置。
我可以以setup.py
安装tvnamer.py
方式进行安装tvnamer
,和/或是否有更好的安装命令行应用程序的方法?
-
尝试
entry_points.console_scripts
在setup()调用中使用参数。如setuptools
docs中所述,这应该可以完成我认为想要的操作。要在此处复制:
from setuptools import setup setup( # other arguments here... entry_points = { 'console_scripts': [ 'foo = package.module:func', 'bar = othermodule:somefunc', ], } )