Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/guides/writing-pyproject-toml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ In this example, after installing your project, a ``spam-cli`` command
will be available. Executing this command will do the equivalent of
``import sys; from spam import main_cli; sys.exit(main_cli())``.

Script entry points must use the ``module:object`` form. The object

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per EPS, this is called an "object reference." I think we should probably use that language consistently and link to it as well:

Suggested change
Script entry points must use the ``module:object`` form. The object
Script entry points are written as object references like ``importable.module``, or importable.module:object.attr``. The object

Ref: https://packaging.python.org/en/latest/specifications/entry-points/#data-model

reference should point to a function that can be called with no arguments,
not to a module by itself.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is de facto true (I think), but in principle I think script entry points can be modules if the user does something cursed like forcefully instantiating a callable module instance.

Not sure if that's worth qualifying though, the "should" is probably good enough 🙂


On Windows, scripts packaged this way need a terminal, so if you launch
them from within a graphical application, they will make a terminal pop
up. To prevent this from happening, use the ``[project.gui-scripts]``
Expand Down
Loading