The problem faced by @agronholm is an error in the validation, indeed the standard seems to allow entry points without the :obj.attr
part. I am correcting this in the supporting validate-pyproject
library.
I am not sure about this behaviour being standard though. I just did a quick test (with stable setuptools, not my experimental branch) with a dummy project using a console script with entry-point in the form of executable = package.module
. Running python -m build
works perfectly, however installing the package with pip install .
fails:
ERROR: For req: myproj==0.0.post1.dev1+g93a69b6.d20220222. Invalid script entry point: <ExportEntry skeleton = myproj.skeleton:None []> - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.
I think this is related to the fact that pip
is used to build the CLI wrappers. I recon that without the :obj.attr
part, pip
does not know which function to call inside the wrapper.
Please note that I am not 100% sure about this, It might be just a pre-existing limitation of setuptools as @CAM-Gerlach mentioned. However I do have the impression that the standard requires the entry-point for console_scripts
to point to an specific function:
Two groups of entry points have special significance in packaging:
console_scripts
andgui_scripts
. In both groups, the name of the entry point should be usable as a command in a system shell after the package is installed. The object reference points to a function which will be called with no arguments when this command is run.
(This “requirement” is not explicitly mandatory, but the text does suggest it).