Skip to content

Commit 73a4ce2

Browse files
abravalheriFlorianWilhelm
authored andcommitted
Use 'options.entry_points' (setup.cfg) in docs
Let's document the best practices :)
1 parent 7635b93 commit 73a4ce2

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

docs/extensions.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ implementation of the :ref:`namespace extension <examples/namespace-extension>`
349349
as well as the `pyproject extension`_ which serves as a blueprint for new
350350
extensions.
351351

352+
352353
Activating Extensions
353354
---------------------
354355

@@ -359,14 +360,13 @@ This is possible by setting up a `setuptools entry point`_ under the
359360
This entry point should point to our extension class, e.g. ``AwesomeFiles``
360361
like defined above. If you for instance use a scaffold generated by PyScaffold
361362
to write a PyScaffold extension (we hope you do ;-), you would add the following
362-
to the ``entry_points`` variable in ``setup.py``:
363+
to the ``options.entry_points`` section in ``setup.cfg``:
363364

364-
.. code-block:: python
365+
.. code-block:: ini
365366
366-
entry_points = """
367-
[pyscaffold.cli]
368-
awesome_files = your_package.your_module:AwesomeFiles
369-
"""
367+
[options.entry_points]
368+
pyscaffold.cli =
369+
awesome_files = your_package.your_module:AwesomeFiles
370370
371371
372372
Examples
@@ -402,15 +402,18 @@ development can be easily bootstrapped with the command::
402402

403403
putup pyscaffoldext-${EXT_NAME} -p ${EXT_NAME} --namespace pyscaffoldext --no-skeleton
404404

405-
If you put your extension code in the module ``extension.py`` then the ``entry_points``
406-
variable in ``setup.py`` looks like:
405+
If you put your extension code in the module ``extension.py`` then the
406+
``options.entry_points`` section in ``setup.cfg`` looks like:
407407

408-
.. code-block:: python
408+
.. code-block:: ini
409409
410-
entry_points = """
411-
[pyscaffold.cli]
412-
awesome_files = pyscaffoldext.${EXT_NAME}.extension:AwesomeFiles
413-
"""
410+
[options.entry_points]
411+
pyscaffold.cli =
412+
awesome_files = pyscaffoldext.${EXT_NAME}.extension:AwesomeFiles
413+
414+
In this example, ``AwesomeFiles`` represents the name of the class that
415+
implementes the extension and ``awesome_files`` is the string used to create
416+
the flag for the ``putup`` command (``--awesome-files``).
414417

415418

416419
Final Considerations

0 commit comments

Comments
 (0)