Skip to content

Commit 52682aa

Browse files
Merge pull request #2388 from VWS-Python/sphinx-python-minimum
Work out minimum Python version so that fewer replacements are needed…
2 parents c4fa85b + 262376a commit 52682aa

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Installation
1313
1414
pip install vws-python
1515
16-
This is tested on Python 3.12+. Get in touch with
16+
This is tested on Python |minimum-python-version|\+. Get in touch with
1717
``[email protected]`` if you would like to use this with another
1818
language.
1919

@@ -78,3 +78,4 @@ documentation <https://vws-python.readthedocs.io/en/latest>`__.
7878
:target: https://badge.fury.io/py/VWS-Python
7979
.. |Documentation Status| image:: https://readthedocs.org/projects/vws-python/badge/?version=latest
8080
:target: https://vws-python.readthedocs.io/en/latest/?badge=latest
81+
.. |minimum-python-version| replace:: 3.12

docs/source/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import datetime
77
import importlib.metadata
88

9+
from packaging.specifiers import SpecifierSet
10+
911
project = "VWS-Python"
1012
author = "Adam Dangoor"
1113

@@ -39,6 +41,14 @@
3941
_month, _day, _year, *_ = version.split(".")
4042
release = f"{_month}.{_day}.{_year}"
4143

44+
45+
project_metadata = importlib.metadata.metadata(distribution_name=project)
46+
requires_python = project_metadata["Requires-Python"]
47+
specifiers = SpecifierSet(specifiers=requires_python)
48+
(specifier,) = specifiers
49+
assert specifier.operator == ">="
50+
minimum_python_version = specifier.version
51+
4252
language = "en"
4353

4454
# The name of the syntax highlighting style to use.
@@ -57,7 +67,7 @@
5767
htmlhelp_basename = "VWSPYTHONdoc"
5868
autoclass_content = "init"
5969
intersphinx_mapping = {
60-
"python": ("https://docs.python.org/3.12", None),
70+
"python": (f"https://docs.python.org/{minimum_python_version}", None),
6171
}
6272
nitpicky = True
6373
nitpick_ignore = (("py:class", "_io.BytesIO"),)
@@ -75,6 +85,7 @@
7585
rst_prolog = f"""
7686
.. |project| replace:: {project}
7787
.. |release| replace:: {release}
88+
.. |minimum-python-version| replace:: {minimum_python_version}
7889
.. |github-owner| replace:: VWS-Python
7990
.. |github-repository| replace:: vws-python
8091
"""

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Installation
88
99
$ pip install vws-python
1010
11-
This is tested on Python 3.12+.
11+
This is tested on Python |minimum-python-version|\+.
1212
Get in touch with ``[email protected]`` if you would like to use this with another language.
1313

1414
Usage

0 commit comments

Comments
 (0)