Skip to content

Commit 9a3f818

Browse files
committed
Require Python 3.11 or newer; remove outdated workarounds
1 parent c9dd1e8 commit 9a3f818

File tree

23 files changed

+38
-496
lines changed

23 files changed

+38
-496
lines changed

.github/workflows/dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ jobs:
188188
#
189189
CIBW_ARCHS: ${{ matrix.arch }}
190190
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
191-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9, <3.13"
191+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11, <3.13"
192192
# Environment during wheel build
193193
CIBW_ENVIRONMENT: "PATH=$(pwd)/prefix/bin:$PATH CPATH=$(pwd)/prefix/include:$CPATH LIBRARY_PATH=$(pwd)/prefix/lib:$LIBRARY_PATH LD_LIBRARY_PATH=$(pwd)/prefix/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/prefix/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal PIP_CONSTRAINT=$(pwd)/constraints.txt PIP_FIND_LINKS=file://$(pwd)/wheelhouse SAGE_NUM_THREADS=6"
194194
# Use 'build', not 'pip wheel'

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ __pycache__/
161161
/src/sage/modular/arithgroup/farey_symbol.h
162162
# List of C and C++ files that are actual source files,
163163
# NOT generated by Cython. The same list appears in src/MANIFEST.in
164-
!/src/sage/cpython/debugimpl.c
165164
!/src/sage/graphs/base/boost_interface.cpp
166165
!/src/sage/graphs/cliquer/cl.c
167166
!/src/sage/graphs/graph_decompositions/sage_tdlib.cpp

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ in the Installation Guide.
222222
more details.
223223

224224
- Python 3.4 or later, or Python 2.7, a full installation including
225-
`urllib`; but ideally version 3.9.x, 3.10.x, 3.11.x, 3.12.x, which
225+
`urllib`; but ideally version 3.11.x or later, which
226226
will avoid having to build Sage's own copy of Python 3.
227227
See [build/pkgs/python3/SPKG.rst](build/pkgs/python3/SPKG.rst)
228228
for more details.
@@ -551,11 +551,11 @@ SAGE_ROOT Root directory (create by git clone)
551551
│ │ ├── installed/
552552
│ │ │ Records of installed non-Python packages
553553
│ │ ├── scripts/ Scripts for uninstalling installed packages
554-
│ │ └── venv-python3.9 (SAGE_VENV)
554+
│ │ └── venv-python (SAGE_VENV)
555555
│ │ │ Installation hierarchy (virtual environment)
556556
│ │ │ for Python packages
557557
│ │ ├── bin/ Executables and installed scripts
558-
│ │ ├── lib/python3.9/site-packages/
558+
│ │ ├── lib/python/site-packages/
559559
│ │ │ Python modules/packages are installed here
560560
│ │ └── var/lib/sage/
561561
│ │ └── wheels/

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,13 @@ classifiers = [
7070
"Operating System :: POSIX",
7171
"Operating System :: MacOS :: MacOS X",
7272
"Programming Language :: Python :: 3 :: Only",
73-
"Programming Language :: Python :: 3.9",
74-
"Programming Language :: Python :: 3.10",
7573
"Programming Language :: Python :: 3.11",
7674
"Programming Language :: Python :: 3.12",
7775
"Programming Language :: Python :: Implementation :: CPython",
7876
"Topic :: Scientific/Engineering :: Mathematics",
7977
]
8078
urls = {Homepage = "https://www.sagemath.org"}
81-
requires-python = ">=3.9, <3.13"
79+
requires-python = ">=3.11, <3.13"
8280

8381
[project.optional-dependencies]
8482
R = [

pyrightconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"root": "src"
88
}
99
],
10-
"pythonVersion": "3.9",
10+
"pythonVersion": "3.11",
1111
"exclude": ["venv"],
1212
"venvPath": "./venv/",
1313
"venv": "./",

ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://docs.astral.sh/ruff/configuration/#config-file-discovery
22

3-
# Assume Python 3.9
4-
target-version = "py39"
3+
# Python 3.11 is the minimum supported version
4+
target-version = "py311"
55

66
lint.select = [
77
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e

src/MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ global-exclude *.cpp
2323
# List of C and C++ files that are actual source files,
2424
# NOT generated by Cython. The same list appears in SAGE_ROOT/.gitignore
2525
#
26-
include sage/cpython/debugimpl.c
2726
include sage/graphs/base/boost_interface.cpp
2827
include sage/graphs/cliquer/cl.c
2928
include sage/libs/eclib/wrap.cpp

src/doc/en/developer/coding_in_python.rst

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@ Sage.
1212
Python language standard
1313
========================
1414

15-
Sage library code needs to be compatible with all versions of Python
16-
that Sage supports. The information regarding the supported versions
17-
can be found in the files ``build/pkgs/python3/spkg-configure.m4`` and
18-
``src/setup.cfg.m4``.
19-
20-
Python 3.9 is the oldest supported version. Hence,
21-
all language and library features that are available in Python 3.9 can
22-
be used; but features introduced in Python 3.10 cannot be used. If a
23-
feature is deprecated in a newer supported version, it must be ensured
24-
that deprecation warnings issued by Python do not lead to failures in
25-
doctests.
15+
Sage follows the time window-based support policy
16+
`SPEC 0 — Minimum Supported Dependencies <https://scientific-python.org/specs/spec-0000/>`_
17+
for Python versions.
18+
The current minimum supported Python version can be found in the
19+
``pyproject.toml`` file. Accordingly, only language and library features
20+
available in this version can be used. If a feature is deprecated in a newer
21+
supported version, it must be ensured that deprecation warnings issued by
22+
Python do not lead to failures in doctests.
2623

2724
Some key language and library features have been backported to older Python versions
2825
using one of two mechanisms:
@@ -34,21 +31,9 @@ using one of two mechanisms:
3431
of annotations). All Sage library code that uses type annotations
3532
should include this ``__future__`` import and follow PEP 563.
3633

37-
- Backport packages
38-
39-
- `importlib_metadata <../reference/spkg/importlib_metadata>`_
40-
(to be used in place of ``importlib.metadata``),
41-
- `importlib_resources <../reference/spkg/importlib_resources>`_
42-
(to be used in place of ``importlib.resources``),
43-
- `typing_extensions <../reference/spkg/typing_extensions>`_
44-
(to be used in place of ``typing``).
45-
46-
The Sage library declares these packages as dependencies and ensures that
47-
versions that provide features of Python 3.11 are available.
48-
49-
Meta :issue:`29756` keeps track of newer Python features and serves
50-
as a starting point for discussions on how to make use of them in the
51-
Sage library.
34+
- The `typing_extensions <../reference/spkg/typing_extensions>`_ package
35+
is used to backport features from newer versions of the ``typing`` module.
36+
The Sage library declares this package as a dependency.
5237

5338

5439
Design

src/doc/en/installation/conda.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Create a new conda environment containing SageMath, either with ``mamba`` or ``c
5050
5151
$ conda create -n sage sage python=X
5252
53-
where ``X`` is version of Python, e.g. ``3.9``.
53+
where ``X`` is version of Python, e.g. ``3.12``.
5454

5555
To use Sage from there,
5656

@@ -86,22 +86,22 @@ Here we assume that you are using a git checkout.
8686

8787
.. code-block:: shell
8888
89-
$ mamba env create --file environment-3.11-linux.yml --name sage-dev
89+
$ mamba env create --file environment-3.12-linux.yml --name sage-dev
9090
$ conda activate sage-dev
9191
9292
.. tab:: conda
9393

9494
.. code-block:: shell
9595
96-
$ conda env create --file environment-3.11-linux.yml --name sage-dev
96+
$ conda env create --file environment-3.12-linux.yml --name sage-dev
9797
$ conda activate sage-dev
9898
99-
Alternatively, you can use ``environment-3.11-linux.yml`` or
100-
``environment-optional-3.11-linux.yml``, which will only install standard
99+
Alternatively, you can use ``environment-3.12-linux.yml`` or
100+
``environment-optional-3.12-linux.yml``, which will only install standard
101101
(and optional) packages without any additional developer tools.
102102

103-
A different Python version can be selected by replacing ``3.11`` by ``3.9``
104-
or ``3.10`` in these commands.
103+
A different Python version can be selected by replacing ``3.12`` with the
104+
desired version.
105105

106106
- Bootstrap the source tree and install the build prerequisites and the Sage library::
107107

@@ -137,7 +137,7 @@ After editing any Cython files, rebuild the Sage library using::
137137

138138
In order to update the conda environment later, you can run::
139139

140-
$ mamba env update --file environment-3.11-linux.yml --name sage-dev
140+
$ mamba env update --file environment-3.12-linux.yml --name sage-dev
141141

142142
To build the documentation, use::
143143

@@ -156,5 +156,5 @@ To build the documentation, use::
156156

157157
You can update the conda lock files by running
158158
``.github/workflows/conda-lock-update.py`` or by running
159-
``conda-lock --platform linux-64 --filename environment-3.11-linux.yml --lockfile environment-3.11-linux.lock``
159+
``conda-lock --platform linux-64 --filename environment-3.12-linux.yml --lockfile environment-3.12-linux.lock``
160160
manually.

src/doc/en/installation/launching.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ Sage uses the following environment variables when it runs:
6767

6868
- See
6969
https://docs.python.org/3/using/cmdline.html#environment-variables
70-
for more variables used by Python (not an exhaustive list). With
71-
Python 3.11 or later, a brief summary can also be obtained by
72-
running `python3 --help-env`.
70+
for more variables used by Python (not an exhaustive list).
71+
A brief summary can also be obtained by running `python3 --help-env`.
7372

7473
Using a Jupyter Notebook remotely
7574
---------------------------------

0 commit comments

Comments
 (0)