Skip to content

Commit

Permalink
sagemathgh-35404: Drop support for Python 3.8
Browse files Browse the repository at this point in the history
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes sagemath#12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

In preparation for important package upgrades, we remove support for
Python v3.8. (Almost) all occurrences of "Python 3.8" are removed from
the codebase. There are still some comments left that essentially say
that in newer versions things can be simplified, but I didn't touch
those and leave them for follow-up PRs.

This will help with:
-  PRs that require Python 3.9 or above, such as
sagemath#34973 and
sagemath#35188.
- Upgrades of Python packages that have dropped support for Python 3.8
because they follow NEP 29 and have already released a new major version
that drops support according to the NEP 29 schedule.
  - NetworkX 3.2 (expected 2023-??; version 3.1 was released 2023-04,
see sagemath#35671)
  - sagemath#34816
  - sagemath#35703
  - See also sagemath#32074.

Test run: https://github.com/tobiasdiez/sage/actions/runs/4586981626

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#35404
Reported by: Tobias Diez
Reviewer(s): Dima Pasechnik, Matthias Köppe
  • Loading branch information
Release Manager committed Aug 23, 2023
2 parents 2d10476 + 11c2a87 commit 103e862
Show file tree
Hide file tree
Showing 38 changed files with 29 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
#
CIBW_ARCHS: ${{ matrix.arch }}
# https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
# Environment during wheel build
CIBW_ENVIRONMENT: "PATH=$(pwd)/local/bin:$PATH CPATH=$(pwd)/local/include:$CPATH LIBRARY_PATH=$(pwd)/local/lib:$LIBRARY_PATH PKG_CONFIG_PATH=$(pwd)/local/share/pkgconfig:$PKG_CONFIG_PATH ACLOCAL_PATH=/usr/share/aclocal"
# Use 'build', not 'pip wheel'
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ on:
default: >-
["ubuntu-trusty-toolchain-gcc_9",
"ubuntu-xenial-toolchain-gcc_9",
"ubuntu-bionic-gcc_8-python3.8",
"ubuntu-focal",
"ubuntu-jammy",
"ubuntu-kinetic",
Expand All @@ -28,16 +27,13 @@ on:
"debian-bullseye",
"debian-bookworm",
"debian-sid",
"linuxmint-19-gcc_8-python3.8",
"linuxmint-19.3-gcc_8-python3.8",
"linuxmint-20.1",
"linuxmint-20.2",
"linuxmint-20.3",
"linuxmint-21",
"linuxmint-21.1",
"linuxmint-21.2",
"fedora-29-python3.8",
"fedora-30-python3.8",
"fedora-30",
"fedora-31",
"fedora-32",
"fedora-33",
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Install pycodestyle
run: pip install tox pycodestyle
- name: Lint using pycodestyle
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Install relint
run: pip install tox relint
- name: Lint using relint
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9
- name: Install tox
run: pip install tox
- name: Lint using tox -e rst
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ in the Installation Guide.
more details.

- Python 3.4 or later, or Python 2.7, a full installation including
`urllib`; but ideally version 3.8.x, 3.9.x, or 3.10.x, which
`urllib`; but ideally version 3.9.x, 3.10.x, or 3.11.x, which
will avoid having to build Sage's own copy of Python 3.
See [build/pkgs/python3/SPKG.rst](build/pkgs/python3/SPKG.rst)
for more details.
Expand Down
1 change: 0 additions & 1 deletion build/pkgs/_python3.8/distros/arch.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/_python3.8/distros/cygwin.txt

This file was deleted.

4 changes: 0 additions & 4 deletions build/pkgs/_python3.8/distros/debian.txt

This file was deleted.

2 changes: 0 additions & 2 deletions build/pkgs/_python3.8/distros/fedora.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/_python3.8/distros/freebsd.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/_python3.8/distros/homebrew.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/_python3.8/distros/macports.txt

This file was deleted.

2 changes: 0 additions & 2 deletions build/pkgs/_python3.8/distros/opensuse.txt

This file was deleted.

18 changes: 0 additions & 18 deletions build/pkgs/backports_zoneinfo/SPKG.rst

This file was deleted.

5 changes: 0 additions & 5 deletions build/pkgs/backports_zoneinfo/checksums.ini

This file was deleted.

4 changes: 0 additions & 4 deletions build/pkgs/backports_zoneinfo/dependencies

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/backports_zoneinfo/distros/conda.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/backports_zoneinfo/install-requires.txt

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/backports_zoneinfo/package-version.txt

This file was deleted.

6 changes: 0 additions & 6 deletions build/pkgs/backports_zoneinfo/spkg-install.in

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/backports_zoneinfo/type

This file was deleted.

2 changes: 1 addition & 1 deletion build/pkgs/python3/SPKG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ By default, Sage will try to use system's ``python3`` to set up a virtual
environment, a.k.a. `venv <https://docs.python.org/3.10/library/venv.html>`_
rather than building a Python 3 installation from scratch.

Sage will accept versions 3.8.x to 3.10.x.
Sage will accept versions 3.9.x to 3.10.x.

You can also use ``--with-python=/path/to/python3_binary`` to tell Sage to use
``/path/to/python3_binary`` to set up the venv. Note that setting up the venv requires
Expand Down
4 changes: 2 additions & 2 deletions build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SAGE_SPKG_CONFIGURE([python3], [
m4_pushdef([MIN_VERSION], [3.8.0])
m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.8.0])
m4_pushdef([MIN_VERSION], [3.9.0])
m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.9.0])
m4_pushdef([LT_STABLE_VERSION], [3.12.0])
m4_pushdef([LT_VERSION], [3.12.0])
AC_ARG_WITH([python],
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/tzlocal/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) backports_zoneinfo pytz_deprecation_shim | $(PYTHON_TOOLCHAIN)
$(PYTHON) pytz_deprecation_shim | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
1 change: 0 additions & 1 deletion m4/setup_cfg_metadata.m4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ classifiers =
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
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
Expand Down
1 change: 0 additions & 1 deletion pkgs/sage-docbuild/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers =
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sage-setup/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ packages =
sage_setup.autogen.interpreters.specs
sage_setup.command

python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12

install_requires =
pkgconfig
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sagemath-categories/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ long_description_content_type = text/x-rst
include(`setup_cfg_metadata.m4')dnl'

[options]
python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12
install_requires =
SPKG_INSTALL_REQUIRES_sagemath_objects

Expand Down
2 changes: 1 addition & 1 deletion pkgs/sagemath-environment/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ long_description_content_type = text/x-rst
include(`setup_cfg_metadata.m4')dnl'

[options]
python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12
install_requires =

py_modules =
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sagemath-objects/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(`setup_cfg_metadata.m4')dnl'

[options]
include(`sage_spkg_versions.m4')dnl'
python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12
install_requires =
SPKG_INSTALL_REQUIRES_gmpy2
SPKG_INSTALL_REQUIRES_cysignals
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sagemath-repl/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ long_description_content_type = text/x-rst
include(`setup_cfg_metadata.m4')dnl'

[options]
python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12
install_requires =
SPKG_INSTALL_REQUIRES_sagemath_objects
SPKG_INSTALL_REQUIRES_sagemath_environment
Expand Down
2 changes: 1 addition & 1 deletion pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"root": "src"
}
],
"pythonVersion": "3.8",
"pythonVersion": "3.9",
"exclude": ["venv"],
"venvPath": "./venv/",
"venv": "./",
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/developer/coding_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ written.
for both examples.

- **Preparsing:** As in Sage's console, `4/3` returns `4/3` and not
`1.3333333333333333` as in Python 3.8. Testing occurs with full Sage
`1.3333333333333333` as in Python. Testing occurs with full Sage
preparsing of input within the standard Sage shell environment, as
described in :ref:`section-preparsing`.

Expand Down
10 changes: 5 additions & 5 deletions src/doc/en/developer/coding_in_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ that Sage supports. The information regarding the supported versions
can be found in the files ``build/pkgs/python3/spkg-configure.m4`` and
``src/setup.cfg.m4``.

As of Sage 9.7, Python 3.8 is the oldest supported version. Hence,
all language and library features that are available in Python 3.8 can
be used; but features introduced in Python 3.9 cannot be used. If a
Python 3.9 is the oldest supported version. Hence,
all language and library features that are available in Python 3.9 can
be used; but features introduced in Python 3.10 cannot be used. If a
feature is deprecated in a newer supported version, it must be ensured
that deprecation warnings issued by Python do not lead to failures in
doctests.

Some key language and library features have been backported to Python 3.8
Some key language and library features have been backported to older Python versions
using one of two mechanisms:

- ``from __future__ import annotations`` (see Python reference for
`__future__ <https://docs.python.org/3.8/library/__future__.html>`_)
`__future__ <https://docs.python.org/3/library/__future__.html>`_)
modernizes type annotations according to `PEP 563
<https://www.python.org/dev/peps/pep-0563>`_ (Postponed evaluation
of annotations). All Sage library code that uses type annotations
Expand Down
5 changes: 0 additions & 5 deletions src/sage/algebras/fusion_rings/f_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,11 +1229,6 @@ def start_worker_pool(self, processes=None):
:meth:`shutdown_worker_pool` to close the pool and properly dispose
of shared memory resources.
.. NOTE::
Python 3.8+ is required, since the ``multiprocessing.shared_memory``
module must be imported.
INPUT:
- ``processes`` -- an integer indicating the number of workers
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/fusion_rings/fusion_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ def get_braid_generators(self,
we don't run the solver again.
- ``use_mp`` -- (default: ``True``) a boolean indicating whether
to use multiprocessing to speed up the computation; this is
highly recommended. Python 3.8+ is required.
highly recommended.
- ``verbose`` -- (default: ``True``) boolean indicating whether
to be verbose with the computation
Expand Down
6 changes: 1 addition & 5 deletions src/sage/algebras/fusion_rings/shm_managers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ cdef class KSHandler:
- ``n_slots`` -- the total number of F-symbols
- ``field`` -- F-matrix's base cyclotomic field
- ``use_mp`` -- a boolean indicating whether to construct a shared
memory block to back ``self``. Requires Python 3.8+, since we
must import the ``multiprocessing.shared_memory`` module.
memory block to back ``self``.
- ``init_data`` -- a dictionary or :class:`KSHandler` object containing
known squares for initialization, e.g., from a solver checkpoint
- ``name`` -- the name of a shared memory object (used by child processes
Expand Down Expand Up @@ -391,9 +390,6 @@ cdef class FvarsHandler:
``name`` attribute. Children processes use the ``name`` attribute,
accessed via ``self.shm.name`` to attach to the shared memory block.
Multiprocessing requires Python 3.8+, since we must import the
``multiprocessing.shared_memory`` module.
INPUT:
- ``n_slots`` -- number of generators of the underlying polynomial ring
Expand Down
2 changes: 1 addition & 1 deletion src/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license_files = LICENSE.txt
include(`setup_cfg_metadata.m4')dnl'

[options]
python_requires = >=3.8, <3.12
python_requires = >=3.9, <3.12
install_requires =
SPKG_INSTALL_REQUIRES_sage_conf
SPKG_INSTALL_REQUIRES_six
Expand Down
9 changes: 4 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -527,24 +527,23 @@ setenv =
# to "--with-system-python3=force" as originally proposed in #32060
PYTHON_MAJOR=3
PYTHON_MINOR=10
python3.8: PYTHON_MINOR=8
python3.9: PYTHON_MINOR=9
python3.10: PYTHON_MINOR=10
python3.11: PYTHON_MINOR=11
python3.12: PYTHON_MINOR=12
CONFIG_CONFIGURE_ARGS_1=--with-system-python3=yes
python3_spkg: CONFIG_CONFIGURE_ARGS_1=--without-system-python3
python3.8,python3.9,python3.10,python3.11,python3.12: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}
python3.8,python3.9,python3.10,python3.11,python3.12: EXTRA_SAGE_PACKAGES_5=_python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR} _bootstrap liblzma bzip2 libffi libpng zlib
python3.9,python3.10,python3.11,python3.12: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}
python3.9,python3.10,python3.11,python3.12: EXTRA_SAGE_PACKAGES_5=_python{env:PYTHON_MAJOR}.{env:PYTHON_MINOR} _bootstrap liblzma bzip2 libffi libpng zlib
macos-python3_xcode: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/usr/bin/python3
macos-{python3_xcode,nohomebrew}-{python3.8}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3
# Homebrew keg installs
homebrew-{python3.8,python3.9,python3.10,python3.11,python3.12}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3
homebrew-{python3.9,python3.10,python3.11,python3.12}: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3
# Installers from https://www.python.org/downloads/macos/ (must manually download and install)
macos-python3_pythonorg: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Frameworks/Python.framework/Versions/{env:PYTHON_MAJOR}.{env:PYTHON_MINOR}/bin/python3
# https://github.com/pypa/manylinux
manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}-cp{env:PYTHON_MAJOR}{env:PYTHON_MINOR}/bin/python3
manylinux-{python3.8,python3.9,python3.10,python3.11,python3.12}: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng
manylinux-{python3.9,python3.10,python3.11,python3.12}: EXTRA_SAGE_PACKAGES_5=_bootstrap liblzma bzip2 libffi libpng
conda: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python3
#
# - toolchain
Expand Down

0 comments on commit 103e862

Please sign in to comment.