Skip to content

Commit ad61e41

Browse files
authored
Drop support for Python 3.8 (#11511)
1 parent 80ec979 commit ad61e41

97 files changed

Lines changed: 319 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
python:
26-
- "3.8"
2726
- "3.9"
2827
- "3.10"
2928
- "3.11"

doc/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@
131131
('js:func', 'string'),
132132
('py:attr', 'srcline'),
133133
('py:class', 'Element'), # sphinx.domains.Domain
134+
('py:class', 'IndexEntry'), # sphinx.domains.IndexEntry
134135
('py:class', 'Node'), # sphinx.domains.Domain
136+
('py:class', 'NullTranslations'), # gettext.NullTranslations
135137
('py:class', 'RoleFunction'), # sphinx.domains.Domain
136138
('py:class', 'Theme'), # sphinx.application.TemplateBridge
137139
('py:class', 'TitleGetter'), # sphinx.domains.Domain

doc/usage/extensions/doctest.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ a comma-separated list of group names.
7979

8080
* ``pyversion``, a string option, can be used to specify the required Python
8181
version for the example to be tested. For instance, in the following case
82-
the example will be tested only for Python versions greater than 3.3::
82+
the example will be tested only for Python versions greater than 3.10::
8383

8484
.. doctest::
85-
:pyversion: > 3.3
85+
:pyversion: > 3.10
8686

8787
The following operands are supported:
8888

doc/usage/installation.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Installing Sphinx
1212
Overview
1313
--------
1414

15-
Sphinx is written in `Python`__ and supports Python 3.8+. It builds upon the
15+
Sphinx is written in `Python`__ and supports Python 3.9+. It builds upon the
1616
shoulders of many third-party libraries such as `Docutils`__ and `Jinja`__,
1717
which are installed when Sphinx is installed.
1818

@@ -84,18 +84,18 @@ Install either ``python3x-sphinx`` using :command:`port`:
8484

8585
::
8686

87-
$ sudo port install py38-sphinx
87+
$ sudo port install py39-sphinx
8888

8989
To set up the executable paths, use the ``port select`` command:
9090

9191
::
9292

93-
$ sudo port select --set python python38
94-
$ sudo port select --set sphinx py38-sphinx
93+
$ sudo port select --set python python39
94+
$ sudo port select --set sphinx py39-sphinx
9595

9696
For more information, refer to the `package overview`__.
9797

98-
__ https://www.macports.org/ports.php?by=library&substr=py38-sphinx
98+
__ https://www.macports.org/ports.php?by=library&substr=py39-sphinx
9999

100100
Anaconda
101101
~~~~~~~~

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ urls.Download = "https://pypi.org/project/Sphinx/"
1313
urls.Homepage = "https://www.sphinx-doc.org/"
1414
urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues"
1515
license.text = "BSD-2-Clause"
16-
requires-python = ">=3.8"
16+
requires-python = ">=3.9"
1717

1818
# Classifiers list: https://pypi.org/classifiers/
1919
classifiers = [
@@ -30,10 +30,10 @@ classifiers = [
3030
"Programming Language :: Python",
3131
"Programming Language :: Python :: 3",
3232
"Programming Language :: Python :: 3 :: Only",
33-
"Programming Language :: Python :: 3.8",
3433
"Programming Language :: Python :: 3.9",
3534
"Programming Language :: Python :: 3.10",
3635
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3.12",
3737
"Programming Language :: Python :: Implementation :: CPython",
3838
"Programming Language :: Python :: Implementation :: PyPy",
3939
"Framework :: Sphinx",
@@ -134,7 +134,7 @@ profile = "black"
134134
remove_redundant_aliases = true
135135

136136
[tool.ruff]
137-
target-version = "py38" # Pin Ruff to Python 3.8
137+
target-version = "py39" # Pin Ruff to Python 3.9
138138
line-length = 95
139139
show-source = true
140140
exclude = [
@@ -286,6 +286,9 @@ select = [
286286
"sphinx/environment/adapters/toctree.py" = ["B026"]
287287

288288
"tests/*" = ["E501"]
289+
# these tests need old ``typing`` generic aliases
290+
"tests/test_util_typing.py" = ["UP006", "UP035"]
291+
"tests/typing_test_data.py" = ["UP006", "UP035"]
289292

290293
[tool.ruff.flake8-quotes]
291294
inline-quotes = "single"
@@ -296,7 +299,7 @@ disallow_incomplete_defs = true
296299
follow_imports = "skip"
297300
ignore_missing_imports = true
298301
no_implicit_optional = true
299-
python_version = "3.8"
302+
python_version = "3.9"
300303
show_column_numbers = true
301304
show_error_codes = true
302305
show_error_context = true

sphinx/addnodes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Any, Sequence
5+
from typing import TYPE_CHECKING, Any
66

77
from docutils import nodes
88
from docutils.nodes import Element
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Sequence
12+
1113
from sphinx.application import Sphinx
1214

1315
# deprecated name -> (object to return, canonical path or empty string)

sphinx/builders/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pickle
77
import time
88
from os import path
9-
from typing import TYPE_CHECKING, Any, Iterable, Sequence
9+
from typing import TYPE_CHECKING, Any
1010

1111
from docutils import nodes
1212
from docutils.nodes import Node
@@ -34,6 +34,8 @@
3434
from sphinx import roles # noqa: F401 isort:skip
3535

3636
if TYPE_CHECKING:
37+
from collections.abc import Iterable, Sequence
38+
3739
from sphinx.application import Sphinx
3840

3941

sphinx/builders/gettext.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from datetime import datetime, timedelta, timezone, tzinfo
88
from os import getenv, path, walk
99
from time import time
10-
from typing import Any, Generator, Iterable
10+
from typing import TYPE_CHECKING, Any
1111
from uuid import uuid4
1212

1313
from docutils import nodes
@@ -27,6 +27,9 @@
2727
from sphinx.util.tags import Tags
2828
from sphinx.util.template import SphinxRenderer
2929

30+
if TYPE_CHECKING:
31+
from collections.abc import Generator, Iterable
32+
3033
logger = logging.getLogger(__name__)
3134

3235

sphinx/builders/html/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import zlib
1212
from datetime import datetime, timezone
1313
from os import path
14-
from typing import IO, Any, Iterable, Iterator, List, Tuple, Type
14+
from typing import IO, TYPE_CHECKING, Any
1515
from urllib.parse import quote
1616

1717
import docutils.readers.doctree
@@ -49,19 +49,22 @@
4949
from sphinx.writers.html import HTMLWriter
5050
from sphinx.writers.html5 import HTML5Translator
5151

52+
if TYPE_CHECKING:
53+
from collections.abc import Iterable, Iterator
54+
5255
#: the filename for the inventory of objects
5356
INVENTORY_FILENAME = 'objects.inv'
5457

5558
logger = logging.getLogger(__name__)
5659
return_codes_re = re.compile('[\r\n]+')
5760

58-
DOMAIN_INDEX_TYPE = Tuple[
61+
DOMAIN_INDEX_TYPE = tuple[
5962
# Index name (e.g. py-modindex)
6063
str,
6164
# Index class
62-
Type[Index],
65+
type[Index],
6366
# list of (heading string, list of index entries) pairs.
64-
List[Tuple[str, List[IndexEntry]]],
67+
list[tuple[str, list[IndexEntry]]],
6568
# whether sub-entries should start collapsed
6669
bool,
6770
]

sphinx/builders/latex/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import warnings
77
from os import path
8-
from typing import Any, Iterable
8+
from typing import TYPE_CHECKING, Any
99

1010
from docutils.frontend import OptionParser
1111
from docutils.nodes import Node
@@ -35,6 +35,9 @@
3535
# load docutils.nodes after loading sphinx.builders.latex.nodes
3636
from docutils import nodes # isort:skip
3737

38+
if TYPE_CHECKING:
39+
from collections.abc import Iterable
40+
3841
XINDY_LANG_OPTIONS = {
3942
# language codes from docutils.writers.latex2e.Babel
4043
# ! xindy language names may differ from those in use by LaTeX/babel

0 commit comments

Comments
 (0)