对于 PyPI 包,我可以让多个控制台脚本名称指向 setup.py 中的同一个脚本吗?

Can I have multiple console script names point to the same script in setup.py for a PyPI package?

让多个控制台脚本名称指向同一个脚本是否可能或一个好主意?例如:

entry_points={
    'console_scripts': ["the-popular-script = scripts.the_popular_script:main",
                        "thps = scripts.the_popular_script:main",
                        "the-other-script" = scripts.the_other_script:main"],
},

那么 the-popular-scriptthps 命令都将使用 the_popular_script.py.

可以,没有任何问题。

安装程序会在安装时写出这些脚本,因此在安装软件包时,您只需在 bin 目录 sysconfig.get_path("scripts") 中写出两个可执行文件。它们将具有相同的内容但不同的文件名。