if I’m writing a package in Python for distribution and I put some scripts to be regarded as executables in the scripts of setup.py, is there a standard way to make them not have the *.py extension? Is it sufficient to just make files that do not have the .py extension, or is anything extra needed? Will removing the .py from the filename that break any of the functionality associated with Python tools like setup.py/distutils etc? Thanks.
if I’m writing a package in Python for distribution and I put some scripts
Share
If you need Windows compatibility then either don’t remove the
.pyextension or use setuptools’entry_pointsoption that automatically generates appropriate for the system script files e.g., to installpip.main()function as a script,pipspecifies insetup.py:It makes sense to use
entry_pointseven if you don’t need Windows compatibility because it generates the correct shebang for you that points to a specific python interpreter (where generic#! /usr/bin/env pythonwould be the wrong thing).