Skip to content

Commit 9ff053b

Browse files
committed
Integrate sphinx-issues for PyPI links
1 parent 71c94d9 commit 9ff053b

18 files changed

Lines changed: 209 additions & 246 deletions

‎requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ sphinx==7.2.6
33
sphinx-autobuild==2021.3.14
44
sphinx-inline-tabs==2023.4.21
55
sphinx-copybutton==0.5.2
6+
sphinx-issues==5.0.1
67
sphinx-toolbox==3.5.0
78
sphinx-jsonschema==1.19.1

‎source/conf.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
extensions = [
3030
"pug_sphinx_extensions",
31+
"sphinx_issues",
3132
"sphinx.ext.extlinks",
3233
"sphinx.ext.intersphinx",
3334
"sphinx.ext.todo",
@@ -194,14 +195,13 @@
194195
github_sponsors_url = f"{github_url}/sponsors"
195196

196197
extlinks = {
197-
"issue": (f"{github_repo_issues_url}/%s", "#%s"),
198-
"pr": (f"{github_repo_url}/pull/%s", "PR #%s"),
199-
"commit": (f"{github_repo_url}/commit/%s", "%s"),
200198
"gh": (f"{github_url}/%s", "GitHub: %s"),
201-
"pypi": ("https://pypi.org/project/%s", "%s"),
202-
"user": (f"{github_sponsors_url}/%s", "@%s"),
203199
}
204200

201+
# -- Options for sphinx_issues --------------------------------------------------------
202+
203+
issues_default_group_project = github_repo_slug
204+
205205
# -- Options for intersphinx ----------------------------------------------------------
206206
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
207207

‎source/discussions/deploying-python-applications.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Windows
5757
Pynsist
5858
^^^^^^^
5959

60-
`Pynsist <https://pypi.org/project/pynsist>`__ is a tool that bundles Python
60+
:pypi:`Pynsist <pynsist>` is a tool that bundles Python
6161
programs together with the Python-interpreter into a single installer based on
6262
NSIS. In most cases, packaging only requires the user to choose a version of
6363
the Python-interpreter and declare the dependencies of the program. The tool
@@ -88,7 +88,7 @@ Windows
8888
py2exe
8989
^^^^^^
9090

91-
`py2exe <https://pypi.org/project/py2exe/>`__ is a distutils extension which
91+
:pypi:`py2exe` is a distutils extension which
9292
allows to build standalone Windows executable programs (32-bit and 64-bit)
9393
from Python scripts. Python versions included in the official development
9494
cycle are supported (refers to `Status of Python branches`__). py2exe can
@@ -105,7 +105,7 @@ macOS
105105
py2app
106106
^^^^^^
107107

108-
`py2app <https://pypi.org/project/py2app/>`__ is a Python setuptools
108+
:pypi:`py2app` is a Python setuptools
109109
command which will allow you to make standalone macOS application
110110
bundles and plugins from Python scripts. Note that py2app MUST be used
111111
on macOS to build applications, it cannot create Mac applications on other
@@ -117,7 +117,7 @@ Unix (including Linux and macOS)
117117
pex
118118
^^^
119119

120-
`pex <https://pypi.org/project/pex/>`__ is a library for generating .pex
120+
:pypi:`pex` is a library for generating .pex
121121
(Python EXecutable) files which are executable Python environments in the
122122
spirit of virtualenvs. pex is an expansion upon the ideas outlined in :pep:`441`
123123
and makes the deployment of Python applications as simple as cp. pex files may

‎source/discussions/distribution-package-vs-import-package.rst‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ install the PyPI package ``foo`` if you see ``import foo``; this may install an
5757
unintended, and potentially even malicious package.)
5858

5959
A distribution package could provide an import package with a different
60-
name. An example of this is the popular Pillow_ library for image
60+
name. An example of this is the popular :pypi:`Pillow` library for image
6161
processing. Its distribution package name is ``Pillow``, but it provides
6262
the import package ``PIL``. This is for historical reasons: Pillow
6363
started as a fork of the PIL library, thus it kept the import name
@@ -72,7 +72,7 @@ Import packages with the same name can be provided by several
7272
distribution packages. Again, forks are a common reason for this.
7373

7474
Conversely, a distribution package can provide several import packages,
75-
although this is less common. An example is the attrs_ distribution
75+
although this is less common. An example is the :pypi:`attrs` distribution
7676
package, which provides both an ``attrs`` import package with a newer
7777
API, and an ``attr`` import package with an older but supported API.
7878

@@ -106,5 +106,3 @@ precise rules are given in the :ref:`name normalization specification
106106
107107
.. _distro: https://en.wikipedia.org/wiki/Linux_distribution
108108
.. _PyPI: https://pypi.org
109-
.. _Pillow: https://pypi.org/project/Pillow
110-
.. _attrs: https://pypi.org/project/attrs

‎source/discussions/downstream-packaging.rst‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ in their installed packages. This has the added advantage of permitting users to
126126
run tests after installing them, for example to check for regressions
127127
after upgrading a dependency. Yet another approach is to split tests or test
128128
data into a separate Python package. Such an approach was taken by
129-
the cryptography_ project, with the large test vectors being split
130-
to cryptography-vectors_ package.
129+
the :pypi:`cryptography` project, with the large test vectors being split
130+
to :pypi:`cryptography-vectors` package.
131131

132132
A good idea is to use your source distribution in the release workflow.
133133
For example, the :ref:`build` tool does exactly that — it first builds a source
@@ -351,9 +351,9 @@ Some specific suggestions are:
351351
of the installed package!
352352

353353
- Make the test suite work offline. Mock network interactions, using
354-
packages such as responses_ or vcrpy_. If that is not possible, make it
354+
packages such as :pypi:`responses` or :pypi:`vcrpy`. If that is not possible, make it
355355
possible to easily disable the tests using Internet access, e.g. via a pytest_
356-
marker. Use pytest-socket_ to verify that your tests work offline. This
356+
marker. Use :pypi:`pytest-socket` to verify that your tests work offline. This
357357
often makes your own test workflows faster and more reliable as well.
358358

359359
- Make your tests work without a specialized setup, or perform the necessary
@@ -389,14 +389,14 @@ Some specific suggestions are:
389389

390390
- If your test suite takes significant time to run, support testing
391391
in parallel. Downstreams often maintain a large number of packages,
392-
and testing them all takes a lot of time. Using pytest-xdist_ can help them
392+
and testing them all takes a lot of time. Using :pypi:`pytest-xdist` can help them
393393
avoid bottlenecks.
394394

395395
- Ideally, support running your test suite via ``pytest``. pytest_ has many
396396
command-line arguments that are truly helpful to downstreams, such as
397397
the ability to conveniently deselect tests, rerun flaky tests
398-
(via pytest-rerunfailures_), add a timeout to prevent tests from hanging
399-
(via pytest-timeout_) or run tests in parallel (via pytest-xdist_).
398+
(via :pypi:`pytest-rerunfailures`), add a timeout to prevent tests from hanging
399+
(via :pypi:`pytest-timeout`) or run tests in parallel (via :pypi:`pytest-xdist`).
400400
Note that test suites don't need to be *written* with ``pytest`` to be
401401
*executed* with ``pytest``: ``pytest`` is able to find and execute almost
402402
all test cases that are compatible with the standard library's ``unittest``
@@ -468,14 +468,6 @@ as well. Some specific suggestions are:
468468
to make it easier to cherry-pick changes to earlier releases when necessary.
469469

470470

471-
.. _responses: https://pypi.org/project/responses/
472-
.. _vcrpy: https://pypi.org/project/vcrpy/
473-
.. _pytest-socket: https://pypi.org/project/pytest-socket/
474-
.. _pytest-xdist: https://pypi.org/project/pytest-xdist/
475471
.. _pytest: https://pytest.org/
476-
.. _pytest-rerunfailures: https://pypi.org/project/pytest-rerunfailures/
477-
.. _pytest-timeout: https://pypi.org/project/pytest-timeout/
478472
.. _Django: https://www.djangoproject.com/
479473
.. _NumPy: https://numpy.org/
480-
.. _cryptography: https://pypi.org/project/cryptography/
481-
.. _cryptography-vectors: https://pypi.org/project/cryptography-vectors/

‎source/flow.rst‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,9 @@ format`_.
6868
At a minimum, the :file:`pyproject.toml` file needs a ``[build-system]`` table
6969
specifying your build tool. There are many build tools available, including
7070
but not limited to :ref:`flit`, :ref:`hatch`, :ref:`pdm`, :ref:`poetry`,
71-
:ref:`setuptools`, `trampolim`_, and `whey`_. Each tool's documentation will
71+
:ref:`setuptools`, :pypi:`trampolim`, and :pypi:`whey`. Each tool's documentation will
7272
show what to put in the ``[build-system]`` table.
7373

74-
.. _trampolim: https://pypi.org/project/trampolim/
75-
.. _whey: https://pypi.org/project/whey/
76-
7774
For example, here is a table for using :ref:`hatch`:
7875

7976
.. code-block:: toml

‎source/guides/creating-and-discovering-plugins.rst‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Using naming convention
1919

2020
If all of the plugins for your application follow the same naming convention,
2121
you can use :func:`pkgutil.iter_modules` to discover all of the top-level
22-
modules that match the naming convention. For example, `Flask`_ uses the
22+
modules that match the naming convention. For example, :pypi:`Flask` uses the
2323
naming convention ``flask_{plugin_name}``. If you wanted to automatically
2424
discover all of the Flask plugins installed:
2525

@@ -35,7 +35,7 @@ discover all of the Flask plugins installed:
3535
if name.startswith('flask_')
3636
}
3737
38-
If you had both the `Flask-SQLAlchemy`_ and `Flask-Talisman`_ plugins installed
38+
If you had both the :pypi:`Flask-SQLAlchemy` and :pypi:`Flask-Talisman <flask-talisman>` plugins installed
3939
then ``discovered_plugins`` would be:
4040

4141
.. code-block:: python
@@ -49,11 +49,6 @@ Using naming convention for plugins also allows you to query
4949
the Python Package Index's :ref:`simple repository API <simple-repository-api>`
5050
for all packages that conform to your naming convention.
5151

52-
.. _Flask: https://pypi.org/project/Flask/
53-
.. _Flask-SQLAlchemy: https://pypi.org/project/Flask-SQLAlchemy/
54-
.. _Flask-Talisman: https://pypi.org/project/flask-talisman
55-
56-
5752
Using namespace packages
5853
========================
5954

‎source/guides/dropping-older-python-versions.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,9 @@ Each version compatibility change should have its own release.
129129

130130
.. tip::
131131

132-
When dropping a Python version, it might also be rewarding to upgrade the project's code syntax generally, apart from updating the versions used in visible places (like the testing environment). Tools like pyupgrade_ or `ruff <https://docs.astral.sh/ruff/linter/>`_ can automate some of this work.
132+
When dropping a Python version, it might also be rewarding to upgrade the project's code syntax generally, apart from updating the versions used in visible places (like the testing environment). Tools like :pypi:`pyupgrade` or `ruff <https://docs.astral.sh/ruff/linter/>`_ can automate some of this work.
133133

134134
.. _discourse-discussion: https://discuss.python.org/t/requires-python-upper-limits/12663
135-
.. _pyupgrade: https://pypi.org/project/pyupgrade/
136135
.. _dependency-management: https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#python-requirement
137136

138137
.. [#] Support for the Metadata 1.2 specification has been added in Pip 9.0.

‎source/guides/installing-using-pip-and-virtual-environments.rst‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Install a package
201201
~~~~~~~~~~~~~~~~~
202202

203203
For example, let's install the
204-
`Requests`_ library from the :term:`Python Package Index (PyPI)`:
204+
:pypi:`Requests <requests>` library from the :term:`Python Package Index (PyPI)`:
205205

206206
.. tab:: Unix/macOS
207207

@@ -232,9 +232,6 @@ pip should download requests and all of its dependencies and install them:
232232
Installing collected packages: chardet, urllib3, certifi, idna, requests
233233
Successfully installed certifi-2017.7.27.1 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
234234
235-
.. _Requests: https://pypi.org/project/requests/
236-
237-
238235
Install a specific package version
239236
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240237

‎source/guides/supporting-multiple-python-versions.rst‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ with a single-source strategy, there are a number of options.
8686
Tools for single-source Python packages
8787
----------------------------------------
8888

89-
`six <https://pypi.org/project/six/>`_ is a tool developed by Benjamin Peterson
90-
for wrapping over the differences between Python 2 and Python 3. The six_
89+
:pypi:`six` is a tool developed by Benjamin Peterson
90+
for wrapping over the differences between Python 2 and Python 3. The :pypi:`six`
9191
package has enjoyed widespread use and may be regarded as a reliable way to
9292
write a single-source Python module that can be use in both Python 2 and 3.
93-
The six_ module can be used from as early as Python 2.5. A tool called
94-
`modernize <https://pypi.org/project/modernize>`_, developed by Armin
93+
The :pypi:`six` module can be used from as early as Python 2.5. A tool called
94+
:pypi:`modernize`, developed by Armin
9595
Ronacher, can be used to automatically apply the code modifications provided
96-
by six_.
96+
by :pypi:`six`.
9797

98-
Similar to six_, `python-future <http://python-future.org/overview.html>`_ is
98+
Similar to :pypi:`six`, `python-future <http://python-future.org/overview.html>`_ is
9999
a package that provides a compatibility layer between Python 2 and Python 3
100-
source code; however, unlike six_, this package aims to provide
100+
source code; however, unlike :pypi:`six`, this package aims to provide
101101
interoperability between Python 2 and Python 3 with a language syntax that
102102
matches one of the two Python versions: one may
103103
use
@@ -107,12 +107,12 @@ use
107107

108108
Because of the bi-directionality, python-future_ offers a pathway to
109109
converting a Python 2 package to Python 3 syntax module-by-module. However, in
110-
contrast to six_, python-future_ is supported only from Python 2.6. Similar to
111-
modernize_ for six_, python-future_ comes with two scripts called ``futurize``
110+
contrast to :pypi:`six`, python-future_ is supported only from Python 2.6. Similar to
111+
:pypi:`modernize` for :pypi:`six`, python-future_ comes with two scripts called ``futurize``
112112
and ``pasteurize`` that can be applied to either a Python 2 module or a Python
113113
3 module respectively.
114114

115-
Use of six_ or python-future_ adds an additional runtime dependency to your
115+
Use of :pypi:`six` or python-future_ adds an additional runtime dependency to your
116116
package: with python-future_, the ``futurize`` script can be called with the
117117
``--stage1`` option to apply only the changes that Python 2.6+ already
118118
provides for forward-compatibility to Python 3. Any remaining compatibility

0 commit comments

Comments
 (0)