Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Python 3.8 #11511

Merged
merged 22 commits into from Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -23,7 +23,6 @@ jobs:
fail-fast: false
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
Expand Down
2 changes: 2 additions & 0 deletions doc/conf.py
Expand Up @@ -131,7 +131,9 @@
('js:func', 'string'),
('py:attr', 'srcline'),
('py:class', 'Element'), # sphinx.domains.Domain
('py:class', 'IndexEntry'), # sphinx.domains.IndexEntry
('py:class', 'Node'), # sphinx.domains.Domain
('py:class', 'NullTranslations'), # gettext.NullTranslations
('py:class', 'RoleFunction'), # sphinx.domains.Domain
('py:class', 'Theme'), # sphinx.application.TemplateBridge
('py:class', 'TitleGetter'), # sphinx.domains.Domain
Expand Down
4 changes: 2 additions & 2 deletions doc/usage/extensions/doctest.rst
Expand Up @@ -79,10 +79,10 @@ a comma-separated list of group names.

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

.. doctest::
:pyversion: > 3.3
:pyversion: > 3.10

The following operands are supported:

Expand Down
10 changes: 5 additions & 5 deletions doc/usage/installation.rst
Expand Up @@ -12,7 +12,7 @@ Installing Sphinx
Overview
--------

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

Expand Down Expand Up @@ -84,18 +84,18 @@ Install either ``python3x-sphinx`` using :command:`port`:

::

$ sudo port install py38-sphinx
$ sudo port install py39-sphinx

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

::

$ sudo port select --set python python38
$ sudo port select --set sphinx py38-sphinx
$ sudo port select --set python python39
$ sudo port select --set sphinx py39-sphinx

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

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

Anaconda
~~~~~~~~
Expand Down
11 changes: 7 additions & 4 deletions pyproject.toml
Expand Up @@ -13,7 +13,7 @@ urls.Download = "https://pypi.org/project/Sphinx/"
urls.Homepage = "https://www.sphinx-doc.org/"
urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues"
license.text = "BSD-2-Clause"
requires-python = ">=3.8"
requires-python = ">=3.9"

# Classifiers list: https://pypi.org/classifiers/
classifiers = [
Expand All @@ -30,10 +30,10 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Framework :: Sphinx",
Expand Down Expand Up @@ -134,7 +134,7 @@ profile = "black"
remove_redundant_aliases = true

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

"tests/*" = ["E501"]
# these tests need old ``typing`` generic aliases
"tests/test_util_typing.py" = ["UP006", "UP035"]
"tests/typing_test_data.py" = ["UP006", "UP035"]

[tool.ruff.flake8-quotes]
inline-quotes = "single"
Expand All @@ -296,7 +299,7 @@ disallow_incomplete_defs = true
follow_imports = "skip"
ignore_missing_imports = true
no_implicit_optional = true
python_version = "3.8"
python_version = "3.9"
show_column_numbers = true
show_error_codes = true
show_error_context = true
Expand Down
4 changes: 3 additions & 1 deletion sphinx/addnodes.py
Expand Up @@ -2,12 +2,14 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Sequence
from typing import TYPE_CHECKING, Any

from docutils import nodes
from docutils.nodes import Element

if TYPE_CHECKING:
from collections.abc import Sequence

from sphinx.application import Sphinx

# deprecated name -> (object to return, canonical path or empty string)
Expand Down
4 changes: 3 additions & 1 deletion sphinx/builders/__init__.py
Expand Up @@ -6,7 +6,7 @@
import pickle
import time
from os import path
from typing import TYPE_CHECKING, Any, Iterable, Sequence
from typing import TYPE_CHECKING, Any

from docutils import nodes
from docutils.nodes import Node
Expand Down Expand Up @@ -34,6 +34,8 @@
from sphinx import roles # noqa: F401 isort:skip

if TYPE_CHECKING:
from collections.abc import Iterable, Sequence

from sphinx.application import Sphinx


Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/gettext.py
Expand Up @@ -7,7 +7,7 @@
from datetime import datetime, timedelta, timezone, tzinfo
from os import getenv, path, walk
from time import time
from typing import Any, Generator, Iterable
from typing import TYPE_CHECKING, Any
from uuid import uuid4

from docutils import nodes
Expand All @@ -27,6 +27,9 @@
from sphinx.util.tags import Tags
from sphinx.util.template import SphinxRenderer

if TYPE_CHECKING:
from collections.abc import Generator, Iterable

logger = logging.getLogger(__name__)


Expand Down
11 changes: 7 additions & 4 deletions sphinx/builders/html/__init__.py
Expand Up @@ -11,7 +11,7 @@
import zlib
from datetime import datetime, timezone
from os import path
from typing import IO, Any, Iterable, Iterator, List, Tuple, Type
from typing import IO, TYPE_CHECKING, Any
from urllib.parse import quote

import docutils.readers.doctree
Expand Down Expand Up @@ -49,19 +49,22 @@
from sphinx.writers.html import HTMLWriter
from sphinx.writers.html5 import HTML5Translator

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator

#: the filename for the inventory of objects
INVENTORY_FILENAME = 'objects.inv'

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

DOMAIN_INDEX_TYPE = Tuple[
DOMAIN_INDEX_TYPE = tuple[
# Index name (e.g. py-modindex)
str,
# Index class
Type[Index],
type[Index],
# list of (heading string, list of index entries) pairs.
List[Tuple[str, List[IndexEntry]]],
list[tuple[str, list[IndexEntry]]],
# whether sub-entries should start collapsed
bool,
]
Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/latex/__init__.py
Expand Up @@ -5,7 +5,7 @@
import os
import warnings
from os import path
from typing import Any, Iterable
from typing import TYPE_CHECKING, Any

from docutils.frontend import OptionParser
from docutils.nodes import Node
Expand Down Expand Up @@ -35,6 +35,9 @@
# load docutils.nodes after loading sphinx.builders.latex.nodes
from docutils import nodes # isort:skip

if TYPE_CHECKING:
from collections.abc import Iterable

XINDY_LANG_OPTIONS = {
# language codes from docutils.writers.latex2e.Babel
# ! xindy language names may differ from those in use by LaTeX/babel
Expand Down
3 changes: 2 additions & 1 deletion sphinx/builders/linkcheck.py
Expand Up @@ -26,7 +26,8 @@
from sphinx.util.nodes import get_node_line

if TYPE_CHECKING:
from typing import Any, Callable, Generator, Iterator
from collections.abc import Generator, Iterator
from typing import Any, Callable

from requests import Response

Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/texinfo.py
Expand Up @@ -5,7 +5,7 @@
import os
import warnings
from os import path
from typing import Any, Iterable
from typing import TYPE_CHECKING, Any

from docutils import nodes
from docutils.frontend import OptionParser
Expand All @@ -28,6 +28,9 @@
from sphinx.util.osutil import SEP, ensuredir, make_filename_from_project
from sphinx.writers.texinfo import TexinfoTranslator, TexinfoWriter

if TYPE_CHECKING:
from collections.abc import Iterable

logger = logging.getLogger(__name__)
template_dir = os.path.join(package_dir, 'templates', 'texinfo')

Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/text.py
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from os import path
from typing import Any, Iterator
from typing import TYPE_CHECKING, Any

from docutils.io import StringOutput
from docutils.nodes import Node
Expand All @@ -15,6 +15,9 @@
from sphinx.util.osutil import ensuredir, os_path
from sphinx.writers.text import TextTranslator, TextWriter

if TYPE_CHECKING:
from collections.abc import Iterator

logger = logging.getLogger(__name__)


Expand Down
5 changes: 4 additions & 1 deletion sphinx/builders/xml.py
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from os import path
from typing import Any, Iterator
from typing import TYPE_CHECKING, Any

from docutils import nodes
from docutils.io import StringOutput
Expand All @@ -17,6 +17,9 @@
from sphinx.util.osutil import ensuredir, os_path
from sphinx.writers.xml import PseudoXMLWriter, XMLWriter

if TYPE_CHECKING:
from collections.abc import Iterator

logger = logging.getLogger(__name__)


Expand Down
4 changes: 3 additions & 1 deletion sphinx/config.py
Expand Up @@ -6,7 +6,7 @@
import traceback
import types
from os import getenv, path
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterator, NamedTuple
from typing import TYPE_CHECKING, Any, Callable, NamedTuple

from sphinx.errors import ConfigError, ExtensionError
from sphinx.locale import _, __
Expand All @@ -22,6 +22,8 @@
from sphinx.util.osutil import _chdir as chdir

if TYPE_CHECKING:
from collections.abc import Generator, Iterator

from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment

Expand Down
4 changes: 2 additions & 2 deletions sphinx/directives/__init__.py
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import re
from typing import TYPE_CHECKING, Any, Generic, List, TypeVar, cast
from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast

from docutils import nodes
from docutils.nodes import Node
Expand Down Expand Up @@ -298,7 +298,7 @@ def run(self) -> list[Node]:
literal_block, line=self.lineno)
messages += [error]

return cast(List[nodes.Node], messages)
return cast(list[nodes.Node], messages)


class DefaultDomain(SphinxDirective):
Expand Down
4 changes: 3 additions & 1 deletion sphinx/domains/__init__.py
Expand Up @@ -8,7 +8,7 @@

import copy
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Callable, Iterable, NamedTuple, Optional, cast
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Optional, cast

from docutils import nodes
from docutils.nodes import Element, Node, system_message
Expand All @@ -21,6 +21,8 @@
from sphinx.util.typing import RoleFunction

if TYPE_CHECKING:
from collections.abc import Iterable

from docutils.parsers.rst import Directive

from sphinx.builders import Builder
Expand Down
5 changes: 4 additions & 1 deletion sphinx/domains/c.py
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import re
from typing import Any, Callable, Generator, Iterator, TypeVar, Union, cast
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, cast

from docutils import nodes
from docutils.nodes import Element, Node, TextElement, system_message
Expand Down Expand Up @@ -47,6 +47,9 @@
from sphinx.util.nodes import make_refnode
from sphinx.util.typing import OptionSpec

if TYPE_CHECKING:
from collections.abc import Generator, Iterator

logger = logging.getLogger(__name__)
T = TypeVar('T')

Expand Down
5 changes: 4 additions & 1 deletion sphinx/domains/cpp.py
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import re
from typing import Any, Callable, Generator, Iterator, TypeVar
from typing import TYPE_CHECKING, Any, Callable, TypeVar

from docutils import nodes
from docutils.nodes import Element, Node, TextElement, system_message
Expand Down Expand Up @@ -48,6 +48,9 @@
from sphinx.util.nodes import make_refnode
from sphinx.util.typing import OptionSpec

if TYPE_CHECKING:
from collections.abc import Generator, Iterator

logger = logging.getLogger(__name__)
T = TypeVar('T')

Expand Down
4 changes: 3 additions & 1 deletion sphinx/domains/index.py
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Iterable
from typing import TYPE_CHECKING, Any

from docutils import nodes
from docutils.nodes import Node, system_message
Expand All @@ -17,6 +17,8 @@
from sphinx.util.typing import OptionSpec

if TYPE_CHECKING:
from collections.abc import Iterable

from sphinx.application import Sphinx


Expand Down