April 2019
Intermediate to advanced
646 pages
16h 48m
English
distutils allows you to create new commands. A new command can be registered with an entry point, which was introduced by setuptools as a simple way to define packages as plugins.
An entry point is a named link to a class or a function that is made available through some APIs in setuptools. Any application can scan for all registered packages and use the linked code as a plugin.
To link the new command, the entry_points metadata can be used in the setup call as follows:
setup(
name="my.command",
entry_points="""
[distutils.commands]
my_command = my.command.module.Class
"""
)
All named links are gathered in named sections. When distutils is loaded, it scans for links that were registered under distutils.commands