mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-14 08:24:46 +00:00
Update documentation regarding entry points
Refer to the PyPA packaging guide Replace references to the deprecated `pkg_resources` docs
This commit is contained in:
parent
5c52d752e6
commit
49f52a8598
3 changed files with 18 additions and 16 deletions
|
|
@ -296,7 +296,11 @@ texinfo_documents = [
|
||||||
|
|
||||||
|
|
||||||
# Example configuration for intersphinx: refer to the Python standard library.
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}
|
intersphinx_mapping = {
|
||||||
|
"python": ("https://docs.python.org/3/", None),
|
||||||
|
"packaging": ("https://packaging.python.org/en/latest/", None),
|
||||||
|
"setuptools": ("https://setuptools.pypa.io/en/latest/", None),
|
||||||
|
}
|
||||||
|
|
||||||
extlinks = {
|
extlinks = {
|
||||||
"issue": ("https://github.com/pycqa/flake8/issues/%s", "#%s"),
|
"issue": ("https://github.com/pycqa/flake8/issues/%s", "#%s"),
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ To get started writing a |Flake8| :term:`plugin` you first need:
|
||||||
|
|
||||||
Once you've gathered these things, you can get started.
|
Once you've gathered these things, you can get started.
|
||||||
|
|
||||||
All plugins for |Flake8| must be registered via `entry points`_. In this
|
All plugins for |Flake8| must be registered via
|
||||||
|
:external:doc:`entry points<specifications/entry-points>`. In this
|
||||||
section we cover:
|
section we cover:
|
||||||
|
|
||||||
- How to register your plugin so |Flake8| can find it
|
- How to register your plugin so |Flake8| can find it
|
||||||
|
|
@ -62,7 +63,3 @@ Here's a tutorial which goes over building an ast checking plugin from scratch:
|
||||||
registering-plugins
|
registering-plugins
|
||||||
plugin-parameters
|
plugin-parameters
|
||||||
formatters
|
formatters
|
||||||
|
|
||||||
|
|
||||||
.. _entry points:
|
|
||||||
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
|
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,15 @@ To register any kind of plugin with |Flake8|, you need:
|
||||||
|
|
||||||
#. A name for your plugin that will (ideally) be unique.
|
#. A name for your plugin that will (ideally) be unique.
|
||||||
|
|
||||||
#. A somewhat recent version of setuptools (newer than 0.7.0 but preferably as
|
|Flake8| relies on functionality provided by build tools called
|
||||||
recent as you can attain).
|
:external:doc:`entry points<specifications/entry-points>`. These allow
|
||||||
|
any package to register a plugin with |Flake8| via that package's metadata.
|
||||||
|Flake8| relies on functionality provided by setuptools called
|
|
||||||
`Entry Points`_. These allow any package to register a plugin with |Flake8|
|
|
||||||
via that package's ``setup.py`` file.
|
|
||||||
|
|
||||||
Let's presume that we already have our plugin written and it's in a module
|
Let's presume that we already have our plugin written and it's in a module
|
||||||
called ``flake8_example``. We might have a ``setup.py`` that looks something
|
called ``flake8_example``. We will also assume ``setuptools`` is used as a
|
||||||
like:
|
:term:`Build Backend`, but be aware that most backends support entry points.
|
||||||
|
|
||||||
|
We might have a ``setup.py`` that looks something like:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
@ -150,5 +149,7 @@ If your plugin is intended to be opt-in, it can set the attribute
|
||||||
:ref:`enable-extensions<option-enable-extensions>` with your plugin's entry
|
:ref:`enable-extensions<option-enable-extensions>` with your plugin's entry
|
||||||
point.
|
point.
|
||||||
|
|
||||||
.. _Entry Points:
|
.. seealso::
|
||||||
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
|
|
||||||
|
The :external:doc:`setuptools user guide <userguide/entry_point>` about
|
||||||
|
entry points.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue