summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2021-07-20 10:34:10 +0100
committerThomas Grainger <tagrain@gmail.com>2021-07-20 10:35:04 +0100
commit45f900b7bf4aa300846727024672c5d49b1b14cf (patch)
treed21759f07a82bf15987fe8d8b22b5e5db0fb9e4c /docs
parent015c7c08cc801fe8abe6be5fbfa7a538f482fdec (diff)
downloadpython-setuptools-git-45f900b7bf4aa300846727024672c5d49b1b14cf.tar.gz
blacken docs
Diffstat (limited to 'docs')
-rw-r--r--docs/userguide/dependency_management.rst42
-rw-r--r--docs/userguide/entry_point.rst12
-rw-r--r--docs/userguide/extension.rst2
-rw-r--r--docs/userguide/package_discovery.rst31
-rw-r--r--docs/userguide/quickstart.rst8
5 files changed, 47 insertions, 48 deletions
diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst
index 1c610790..9071753d 100644
--- a/docs/userguide/dependency_management.rst
+++ b/docs/userguide/dependency_management.rst
@@ -62,11 +62,8 @@ finesse to it, let's start with a simple example.
.. code-block:: python
setup(
- #...,
- install_requires = [
- 'docutils',
- 'BazSpam ==1.1'
- ]
+ # ...,
+ install_requires=["docutils", "BazSpam ==1.1"]
)
@@ -98,9 +95,10 @@ the Python version is older than 3.4. To accomplish this
.. code-block:: python
setup(
- #...
+ # ...
install_requires=[
- "enum34;python_version<'3.4'",]
+ "enum34;python_version<'3.4'",
+ ]
)
Similarly, if you also wish to declare ``pywin32`` with a minimal version of 1.0
@@ -121,11 +119,11 @@ and only install it if the user is using a Windows operating system:
.. code-block:: python
setup(
- #...
+ # ...
install_requires=[
"enum34;python_version<'3.4'",
- "pywin32 >= 1.0;platform_system=='Windows'"
- ]
+ "pywin32 >= 1.0;platform_system=='Windows'",
+ ]
)
The environmental markers that may be used for testing platform types are
@@ -204,10 +202,8 @@ distributions, if the package's dependencies aren't already installed:
.. code-block:: python
setup(
- #...
- dependency_links=[
- "http://peak.telecommunity.com/snapshots/"
- ],
+ # ...
+ dependency_links=["http://peak.telecommunity.com/snapshots/"],
)
@@ -242,10 +238,10 @@ dependencies for it to work:
setup(
name="Project-A",
- #...
+ # ...
extras_require={
- "PDF": ["ReportLab>=1.2", "RXP"],
- }
+ "PDF": ["ReportLab>=1.2", "RXP"],
+ },
)
The name ``PDF`` is an arbitrary identifier of such a list of dependencies, to
@@ -274,14 +270,14 @@ First is the console_scripts entry point:
.. code-block:: python
setup(
- name = "Project-A"
- #...,
+ name="Project-A",
+ ...,
entry_points={
"console_scripts": [
"rst2pdf = project_a.tools.pdfgen [PDF]",
"rst2html = project_a.tools.htmlgen",
],
- }
+ },
)
This syntax indicates that the entry point (in this case a console script)
@@ -312,11 +308,7 @@ installed, it might declare the dependency like this:
.. code-block:: python
- setup(
- name="Project-B",
- install_requires=["Project-A[PDF]"],
- ...
- )
+ setup(name="Project-B", install_requires=["Project-A[PDF]"], ...)
This will cause ReportLab to be installed along with project A, if project B is
installed -- even if project A was already installed. In this way, a project
diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst
index 63d30a48..3244ce39 100644
--- a/docs/userguide/entry_point.rst
+++ b/docs/userguide/entry_point.rst
@@ -36,7 +36,8 @@ and ``__main__.py`` providing a hook:
.. code-block:: python
from . import hello_world
- if __name__ == '__main__':
+
+ if __name__ == "__main__":
hello_world()
After installing the package, the function may be invoked through the
@@ -102,10 +103,10 @@ module (part of stdlib since Python 3.8) or its backport,
For example, to find the console script entry points from the example above:
-.. code-block:: python
+.. code-block:: pycon
>>> from importlib import metadata
- >>> eps = metadata.entry_points()['console_scripts']
+ >>> eps = metadata.entry_points()["console_scripts"]
``eps`` is now a list of ``EntryPoint`` objects, one of which corresponds
to the ``hello-world = timmins:hello_world`` defined above. Each ``EntryPoint``
@@ -121,13 +122,14 @@ method to import and load that entry point (module or object).
Then, a different project wishing to load 'my.plugins' plugins could run
the following routine to load (and invoke) such plugins:
-.. code-block:: python
+.. code-block:: pycon
>>> from importlib import metadata
- >>> eps = metadata.entry_points()['my.plugins']
+ >>> eps = metadata.entry_points()["my.plugins"]
>>> for ep in eps:
... plugin = ep.load()
... plugin()
+ ...
The project soliciting the entry points needs not to have any dependency
or prior knowledge about the libraries implementing the entry points, and
diff --git a/docs/userguide/extension.rst b/docs/userguide/extension.rst
index 4de24ec9..93b59501 100644
--- a/docs/userguide/extension.rst
+++ b/docs/userguide/extension.rst
@@ -202,7 +202,7 @@ called "foobar", you would write a function something like this:
.. code-block:: python
def find_files_for_foobar(dirname):
- # loop to yield paths that start with `dirname`
+ ... # loop to yield paths that start with `dirname`
And you would register it in a setup script using something like this::
diff --git a/docs/userguide/package_discovery.rst b/docs/userguide/package_discovery.rst
index 0a8070ae..e371e868 100644
--- a/docs/userguide/package_discovery.rst
+++ b/docs/userguide/package_discovery.rst
@@ -34,8 +34,8 @@ included manually in the following manner:
.. code-block:: python
setup(
- #...
- packages = ['mypkg1', 'mypkg2']
+ # ...
+ packages=["mypkg1", "mypkg2"]
)
This can get tiresome reallly quickly. To speed things up, we introduce two
@@ -55,7 +55,8 @@ functions provided by setuptools:
.. code-block:: python
from setuptools import find_packages
- #or
+
+ # or
from setuptools import find_namespace_packages
@@ -98,14 +99,18 @@ in ``src`` that starts with the name ``pkg`` and not ``additional``:
.. code-block:: python
setup(
- #...
- packages = find_packages(
- where = 'src',
- include = ['pkg*',],
- exclude = ['additional',]
+ # ...
+ packages=find_packages(
+ where="src",
+ include=[
+ "pkg*",
+ ],
+ exclude=[
+ "additional",
+ ],
),
- package_dir = {"":"src"}
- #...
+ package_dir={"": "src"}
+ # ...
)
@@ -129,7 +134,7 @@ If both ``Desktop`` and ``Library`` are on your ``PYTHONPATH``, then a
namespace package called ``timmins`` will be created automatically for you when
you invoke the import mechanism, allowing you to accomplish the following
-.. code-block:: python
+.. code-block:: pycon
>>> import timmins.foo
>>> import timmins.bar
@@ -220,7 +225,7 @@ And the ``namespace_packages`` keyword in your ``setup.cfg`` or ``setup.py``:
setup(
# ...
- namespace_packages = ['timmins']
+ namespace_packages=["timmins"]
)
And your directory should look like this
@@ -245,6 +250,6 @@ file contains the following:
.. code-block:: python
- __path__ = __import__('pkgutil').extend_path(__path__, __name__)
+ __path__ = __import__("pkgutil").extend_path(__path__, __name__)
The project layout remains the same and ``setup.cfg`` remains the same.
diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst
index 1bd04ded..0ab23ca2 100644
--- a/docs/userguide/quickstart.rst
+++ b/docs/userguide/quickstart.rst
@@ -60,11 +60,11 @@ the minimum
from setuptools import setup
setup(
- name='mypackage',
- version='0.0.1',
- packages=['mypackage'],
+ name="mypackage",
+ version="0.0.1",
+ packages=["mypackage"],
install_requires=[
- 'requests',
+ "requests",
'importlib; python_version == "2.6"',
],
)