Skip to content

Commit

Permalink
Use 'options.entry_points' (setup.cfg) in docs
Browse files Browse the repository at this point in the history
Let's document the best practices :)
  • Loading branch information
abravalheri committed Jun 15, 2018
1 parent cfa22a6 commit 6fb216b
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions docs/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ implementation of the :ref:`namespace extension <examples/namespace-extension>`
as well as the `pyproject extension`_ which serves as a blueprint for new
extensions.


Activating Extensions
---------------------

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

.. code-block:: python
.. code-block:: ini
entry_points = """
[pyscaffold.cli]
awesome_files = your_package.your_module:AwesomeFiles
"""
[options.entry_points]
pyscaffold.cli =
awesome_files = your_package.your_module:AwesomeFiles
Examples
Expand Down Expand Up @@ -402,15 +402,18 @@ development can be easily bootstrapped with the command::

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

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

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


Final Considerations
Expand Down

0 comments on commit 6fb216b

Please sign in to comment.