Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
fail-fast: false
matrix:
python:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
Expand Down
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target-version = "py310" # Pin Ruff to Python 3.10
target-version = "py311" # Pin Ruff to Python 3.11
line-length = 88
output-format = "full"

Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Release 8.2.0 (in development)
Dependencies
------------

* #13000: Drop Python 3.10 support.

Incompatible changes
--------------------

Expand Down
6 changes: 3 additions & 3 deletions doc/internals/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,18 @@ of targets and allows testing against multiple different Python environments:

tox -av

* To run unit tests for a specific Python version, such as Python 3.12:
* To run unit tests for a specific Python version, such as Python 3.13:

.. code-block:: shell

tox -e py312
tox -e py313

* Arguments to :program:`pytest` can be passed via :program:`tox`,
e.g., in order to run a particular test:

.. code-block:: shell

tox -e py312 tests/test_module.py::test_new_feature
tox -e py313 tests/test_module.py::test_new_feature

You can also test by installing dependencies in your local environment:

Expand Down
8 changes: 4 additions & 4 deletions doc/usage/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ Install either ``python3x-sphinx`` using :command:`port`:

::

$ sudo port install py312-sphinx
$ sudo port install py313-sphinx

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

::

$ sudo port select --set python python312
$ sudo port select --set sphinx py312-sphinx
$ sudo port select --set python python313
$ sudo port select --set sphinx py313-sphinx

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

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

Windows
~~~~~~~
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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.10"
requires-python = ">=3.11"

# Classifiers list: https://pypi.org/classifiers/
classifiers = [
Expand All @@ -31,7 +31,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand Down Expand Up @@ -71,7 +70,6 @@ dependencies = [
"imagesize>=1.3",
"requests>=2.30.0",
"packaging>=23.0",
"tomli>=2; python_version < '3.11'",
"colorama>=0.4.6; sys_platform == 'win32'",
]
dynamic = ["version"]
Expand All @@ -92,7 +90,6 @@ lint = [
"types-Pygments==2.18.0.20240506",
"types-requests==2.32.0.20240914", # align with requests
"types-urllib3==1.26.25.14",
"tomli>=2", # for mypy (Python<=3.10)
"pyright==1.1.384",
"pytest>=6.0",
]
Expand Down Expand Up @@ -204,7 +201,7 @@ exclude = [
# tests/test_writers
"^utils/convert_attestations\\.py$",
]
python_version = "3.10"
python_version = "3.11"
strict = true
show_column_numbers = true
show_error_context = true
Expand Down
6 changes: 1 addition & 5 deletions sphinx/cmd/make_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os
import subprocess
import sys
from contextlib import chdir
from os import path
from typing import TYPE_CHECKING

Expand All @@ -20,11 +21,6 @@
from sphinx.util.console import blue, bold, color_terminal, nocolor
from sphinx.util.osutil import rmtree

if sys.version_info >= (3, 11):
from contextlib import chdir
else:
from sphinx.util.osutil import _chdir as chdir

if TYPE_CHECKING:
from collections.abc import Sequence

Expand Down
7 changes: 1 addition & 6 deletions sphinx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from __future__ import annotations

import sys
import time
import traceback
import types
import warnings
from contextlib import chdir
from os import getenv, path
from typing import TYPE_CHECKING, Any, Literal, NamedTuple

Expand All @@ -16,11 +16,6 @@
from sphinx.util import logging
from sphinx.util.osutil import fs_encoding

if sys.version_info >= (3, 11):
from contextlib import chdir
else:
from sphinx.util.osutil import _chdir as chdir

if TYPE_CHECKING:
import os
from collections.abc import Collection, Iterable, Iterator, Sequence, Set
Expand Down
3 changes: 1 addition & 2 deletions sphinx/domains/_domains_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator, Mapping, Set
from typing import Any, Final, Literal, NoReturn
from typing import Any, Final, Literal, NoReturn, Self

from docutils import nodes
from typing_extensions import Self

from sphinx.domains import Domain
from sphinx.domains.c import CDomain
Expand Down
3 changes: 1 addition & 2 deletions sphinx/domains/c/_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

if TYPE_CHECKING:
from collections.abc import Callable, Iterable, Iterator, Sequence

from typing_extensions import Self
from typing import Self

from sphinx.environment import BuildEnvironment

Expand Down
11 changes: 2 additions & 9 deletions sphinx/theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shutil
import sys
import tempfile
import tomllib
from importlib.metadata import entry_points
from os import path
from typing import TYPE_CHECKING, Any
Expand All @@ -22,17 +23,9 @@
from sphinx.util import logging
from sphinx.util.osutil import ensuredir

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib


if TYPE_CHECKING:
from collections.abc import Callable
from typing import TypedDict

from typing_extensions import Required
from typing import Required, TypedDict

from sphinx.application import Sphinx

Expand Down
8 changes: 2 additions & 6 deletions sphinx/util/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import os
import re
import sys
from datetime import datetime, timezone
from datetime import datetime
from os import path
from typing import TYPE_CHECKING, NamedTuple

Expand Down Expand Up @@ -60,10 +59,7 @@ def __call__( # NoQA: E704

Formatter: TypeAlias = DateFormatter | TimeFormatter | DatetimeFormatter

if sys.version_info[:2] >= (3, 11):
from datetime import UTC
else:
UTC = timezone.utc
from datetime import UTC

logger = logging.getLogger(__name__)

Expand Down
26 changes: 0 additions & 26 deletions sphinx/util/osutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from sphinx.locale import __

if TYPE_CHECKING:
from types import TracebackType
from typing import Any

# SEP separates path elements in the canonical file names
Expand Down Expand Up @@ -173,31 +172,6 @@ def relpath(
abspath = path.abspath


class _chdir:
"""Remove this fall-back once support for Python 3.10 is removed."""

def __init__(self, target_dir: str, /) -> None:
self.path = target_dir
self._dirs: list[str] = []

def __enter__(self) -> None:
self._dirs.append(os.getcwd())
os.chdir(self.path)

def __exit__(
self,
type: type[BaseException] | None,
value: BaseException | None,
traceback: TracebackType | None,
/,
) -> None:
os.chdir(self._dirs.pop())


if sys.version_info[:2] < (3, 11):
cd = _chdir


class FileAvoidWrite:
"""File-like object that buffers output and only writes if content changed.

Expand Down
20 changes: 4 additions & 16 deletions sphinx/util/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
TypedDict,
TypeVar,
Union,
Unpack,
)

from docutils import nodes
Expand Down Expand Up @@ -121,8 +122,7 @@ def __call__( # NoQA: E704
# Readable file stream for inventory loading
if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self
from typing import Self

_T_co = TypeVar('_T_co', str, bytes, covariant=True)

Expand Down Expand Up @@ -221,19 +221,7 @@ def _is_annotated_form(obj: Any) -> TypeIs[Annotated[Any, ...]]:

def _is_unpack_form(obj: Any) -> bool:
"""Check if the object is :class:`typing.Unpack` or equivalent."""
if sys.version_info >= (3, 11):
from typing import Unpack

# typing_extensions.Unpack != typing.Unpack for 3.11, but we assume
# that typing_extensions.Unpack should not be used in that case
return typing.get_origin(obj) is Unpack

# Python 3.10 requires typing_extensions.Unpack
origin = typing.get_origin(obj)
return (
getattr(origin, '__module__', None) == 'typing_extensions'
and origin.__name__ == 'Unpack'
)
return typing.get_origin(obj) is Unpack


def restify(cls: Any, mode: _RestifyMode = 'fully-qualified-except-typing') -> str:
Expand Down Expand Up @@ -361,7 +349,7 @@ def restify(cls: Any, mode: _RestifyMode = 'fully-qualified-except-typing') -> s
return rf'{text}\ [{args}]'
elif isinstance(cls, typing._SpecialForm):
return f':py:obj:`~{cls.__module__}.{cls.__name__}`' # type: ignore[attr-defined]
elif sys.version_info[:2] >= (3, 11) and cls is typing.Any:
elif cls is typing.Any:
# handle bpo-46998
return f':py:obj:`~{cls.__module__}.{cls.__name__}`'
elif hasattr(cls, '__qualname__'):
Expand Down
7 changes: 1 addition & 6 deletions tests/test_builders/test_build_gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
import os
import re
import subprocess
import sys
from contextlib import chdir
from subprocess import CalledProcessError

import pytest

from sphinx.builders.gettext import Catalog, MsgOrigin

if sys.version_info[:2] >= (3, 11):
from contextlib import chdir
else:
from sphinx.util.osutil import _chdir as chdir

_MSGID_PATTERN = re.compile(r'msgid "((?:\n|.)*?)"\nmsgstr', re.MULTILINE)


Expand Down
6 changes: 1 addition & 5 deletions tests/test_builders/test_build_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import re
import subprocess
from contextlib import chdir
from pathlib import Path
from shutil import copyfile
from subprocess import CalledProcessError
Expand All @@ -20,11 +21,6 @@

from tests.utils import http_server

try:
from contextlib import chdir
except ImportError:
from sphinx.util.osutil import _chdir as chdir

STYLEFILES = [
'article.cls',
'fancyhdr.sty',
Expand Down
4 changes: 1 addition & 3 deletions tests/test_extensions/test_ext_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,13 +1571,11 @@ def brief(self, doc: str, *, indent: int = 0, **options: Any) -> list[str]:
'(value, names=None, *values, module=None, '
'qualname=None, type=None, start=1, boundary=None)'
)
elif sys.version_info[:2] >= (3, 11):
else:
args = (
'(value, names=None, *, module=None, qualname=None, '
'type=None, start=1, boundary=None)'
)
else:
args = '(value)'

return self._node('class', self.name, doc, args=args, indent=indent, **options)

Expand Down
Loading
Loading