| 1 |
Configuring builders |
| 2 |
==================== |
| 3 |
|
| 4 |
Discover builders by entry point |
| 5 |
-------------------------------- |
| 6 |
|
| 7 |
.. versionadded:: 1.6 |
| 8 |
|
| 9 |
:term:`builder` extensions can be discovered by means of `entry points`_ so |
| 10 |
that they do not have to be listed in the :confval:`extensions` configuration |
| 11 |
value. |
| 12 |
|
| 13 |
Builder extensions should define an entry point in the ``"sphinx.builders"`` |
| 14 |
group. The name of the entry point needs to match your builder's |
| 15 |
:attr:`~.Builder.name` attribute, which is the name passed to the |
| 16 |
:option:`sphinx-build --builder` option. The entry point value should equal the |
| 17 |
dotted name of the extension module. Here is an example of how an entry point |
| 18 |
for 'mybuilder' can be defined in the extension's ``pyproject.toml`` |
| 19 |
|
| 20 |
.. code-block:: toml |
| 21 |
|
| 22 |
[project.entry-points."sphinx.builders"] |
| 23 |
mybuilder = "my.extension.module" |
| 24 |
|
| 25 |
Note that it is still necessary to register the builder using |
| 26 |
:meth:`~.Sphinx.add_builder` in the extension's :func:`setup` function. |
| 27 |
|
| 28 |
.. _entry points: https://setuptools.pypa.io/en/latest/userguide/entry_point.html |