diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2021-07-21 18:09:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-21 18:09:58 -0400 |
| commit | 1b8472486ce309b5ddd1b8b3f95627437e19b14b (patch) | |
| tree | b0d8efb3da16f51e1eb271e0743bb199b867ee78 | |
| parent | 0e5d10b1935f568759b31689f8bd054b1a2fc5cf (diff) | |
| parent | db3dd226eb52d437dc8859e19dcef82cbbbba547 (diff) | |
| download | python-setuptools-git-1b8472486ce309b5ddd1b8b3f95627437e19b14b.tar.gz | |
Merge pull request #2737 from graingert/run-pre-commit-in-ci
remove unused black pre-commit hook and blacken docs
| -rw-r--r-- | .pre-commit-config.yaml | 5 | ||||
| -rw-r--r-- | changelog.d/2737.doc.rst | 1 | ||||
| -rw-r--r-- | docs/userguide/dependency_management.rst | 37 | ||||
| -rw-r--r-- | docs/userguide/entry_point.rst | 6 | ||||
| -rw-r--r-- | docs/userguide/extension.rst | 2 | ||||
| -rw-r--r-- | docs/userguide/package_discovery.rst | 25 |
6 files changed, 38 insertions, 38 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index f66bf563..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -repos: -- repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black diff --git a/changelog.d/2737.doc.rst b/changelog.d/2737.doc.rst new file mode 100644 index 00000000..5ece0691 --- /dev/null +++ b/changelog.d/2737.doc.rst @@ -0,0 +1 @@ +fix various syntax and style errors in code snippets in docs diff --git a/docs/userguide/dependency_management.rst b/docs/userguide/dependency_management.rst index 1c610790..b97896ba 100644 --- a/docs/userguide/dependency_management.rst +++ b/docs/userguide/dependency_management.rst @@ -62,11 +62,11 @@ finesse to it, let's start with a simple example. .. code-block:: python setup( - #..., - install_requires = [ + ..., + install_requires=[ 'docutils', - 'BazSpam ==1.1' - ] + 'BazSpam ==1.1', + ], ) @@ -98,9 +98,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 +122,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,9 +205,9 @@ distributions, if the package's dependencies aren't already installed: .. code-block:: python setup( - #... + ..., dependency_links=[ - "http://peak.telecommunity.com/snapshots/" + "http://peak.telecommunity.com/snapshots/", ], ) @@ -242,10 +243,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 +275,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) @@ -315,7 +316,7 @@ installed, it might declare the dependency like this: setup( name="Project-B", install_requires=["Project-A[PDF]"], - ... + ..., ) This will cause ReportLab to be installed along with project A, if project B is diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index 63d30a48..c92ccf76 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -36,6 +36,7 @@ and ``__main__.py`` providing a hook: .. code-block:: python from . import hello_world + if __name__ == '__main__': hello_world() @@ -102,7 +103,7 @@ 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'] @@ -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'] >>> 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..551e02e6 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,14 @@ 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 +130,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 +221,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 |
