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

Allow python 3.12 and scipy 1.12 #37270

Merged
merged 8 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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 build/pkgs/_python3.12/distros/debian.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
python3.12
python3.12-dev
python3.12-distutils
python3.12-venv
9 changes: 4 additions & 5 deletions build/pkgs/python3/SPKG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ 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.9.x to 3.10.x.
Sage will accept versions 3.9.x to 3.11.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
a number of Python modules to be available within the Python in question. Currently,
as of Sage 9.7, these modules are as follows: ``sqlite3``, ``ctypes``, ``math``,
``hashlib``, ``socket``, ``zlib``, ``distutils.core``, ``ssl`` -
they will be checked for by the ``configure`` script.
as of Sage 10.3, these modules are as follows: ``sqlite3``, ``ctypes``, ``math``,
``hashlib``, ``socket``, ``zlib``, ``ssl``, ``ensurepip``.

Use the ``configure`` option ``--without-system-python3`` in case you want Python 3
Use the ``configure`` option ``--without-system-python3`` if you want Python 3
built from scratch.


Expand Down
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/alpine.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python3-dev
py3-setuptools
2 changes: 1 addition & 1 deletion build/pkgs/python3/distros/debian.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python3
libpython3-dev
python3-distutils
python3-setuptools
python3-venv
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/fedora.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python3-devel
python-setuptools
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/freebsd.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lang/python
devel/py-setuptools
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/homebrew.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# This installs /usr/local/bin/python3 -> python3.9
python3
python-setuptools
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/macports.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python310
py-setuptools
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/opensuse.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python3${PYTHON_MINOR}-devel
python3${PYTHON_MINOR}-setuptools
1 change: 1 addition & 0 deletions build/pkgs/python3/distros/void.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python3-devel
python3-setuptools
8 changes: 4 additions & 4 deletions build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SAGE_SPKG_CONFIGURE([python3], [
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])
m4_pushdef([LT_VERSION], [3.13.0])
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python=PYTHON3],
[Python 3 executable to use for the Sage venv; default: python3])])
Expand All @@ -24,8 +24,8 @@ SAGE_SPKG_CONFIGURE([python3], [
dnl Check if we can do venv with a system python3
dnl instead of building our own copy.
dnl Trac #31160: We no longer check for readline here.
check_modules="sqlite3, ctypes, math, hashlib, socket, zlib, distutils.core, ssl, ensurepip"
AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules], [ac_cv_path_PYTHON3], [
check_modules="sqlite3, ctypes, math, hashlib, socket, zlib, ssl, ensurepip"
AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules and setuptools/distutils], [ac_cv_path_PYTHON3], [
AS_IF([test x"$ac_path_PYTHON3" != x], [dnl checking explicitly specified $with_python
AC_MSG_RESULT([])
AC_PATH_PROG([ac_path_PYTHON3], [$ac_path_PYTHON3])
Expand All @@ -40,7 +40,7 @@ SAGE_SPKG_CONFIGURE([python3], [
ac_path_PYTHON3_found=:
AC_MSG_RESULT([yes])
dnl introduction for AC_MSG_RESULT printed by AC_CACHE_CHECK
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules])
AC_MSG_CHECKING([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules and setuptools/distutils])
])
AS_IF([test -z "$ac_cv_path_PYTHON3"], [
AC_MSG_ERROR([the python3 selected using --with-python=$with_python is not suitable])
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/scipy/install-requires.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# deprecations cannot be introduced in micro releases.
# SciPy devs wait "at least 6 months", "in practice two (minor) releases"
# from deprecation to removal of a feature.
scipy >=1.5, <1.12
scipy >=1.5
2 changes: 1 addition & 1 deletion m4/pyproject_toml_metadata.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ classifiers = [
"Topic :: Scientific/Engineering :: Mathematics",
]
urls = {Homepage = "https://www.sagemath.org"}
requires-python = ">=3.9, <3.12"
requires-python = ">=3.9, <3.13"
28 changes: 21 additions & 7 deletions m4/sage_check_python_for_venv.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,23 @@ AC_DEFUN([SAGE_CHECK_PYTHON_FOR_VENV], [
AX_COMPARE_VERSION([$python3_version], [ge], MIN_VERSION, [
AX_COMPARE_VERSION([$python3_version], [lt], LT_VERSION, [
dnl Because the system python is not used directly but rather in a venv without site-packages,
dnl we test whether the module will be available in a venv.
dnl we should test whether the module will be available in a venv.
dnl Otherwise, some system site-package may be providing this module to the system python.
dnl However, on Python >= 3.12, we need setuptools to run our extension compilation tests
dnl because distutils has been removed from the standard library.
AX_COMPARE_VERSION([$python3_version], [ge], [3.12.0], [
conftest_venv_options="--system-site-packages"
distutils_core="setuptools"
distutils_extension="setuptools.extension"
], [
conftest_venv_options=
distutils_core="distutils.core"
distutils_extension="distutils.extension"
])
all_required_modules="]REQUIRED_MODULES[, $distutils_core, $distutils_extension"
dnl m4_define([conftest_venv], [config-venv]) .... for debugging only
rm -rf conftest_venv
AS_IF(["]PYTHON_EXE[" build/bin/sage-venv conftest_venv && conftest_venv/bin/python3 -c "import ]REQUIRED_MODULES[" 2>& ]AS_MESSAGE_LOG_FD, [
AS_IF(["]PYTHON_EXE[" build/bin/sage-venv $conftest_venv_options conftest_venv && conftest_venv/bin/python3 -c "import $all_required_modules" 2>& ]AS_MESSAGE_LOG_FD, [
AS_VAR_SET([python3_result], [yes])
SAGE_PYTHON_CHECK_DISTUTILS([CC="$CC" CXX="$CXX" conftest_venv/bin/python3], [
SAGE_ARCHFLAGS="unset"
Expand All @@ -46,7 +58,7 @@ AC_DEFUN([SAGE_CHECK_PYTHON_FOR_VENV], [
AC_MSG_RESULT([$python3_result])
])
], [
AC_MSG_RESULT([no, the version is in the supported range but cannot import one of the required modules: ]REQUIRED_MODULES)
AC_MSG_RESULT([no, the version is in the supported range but cannot import one of the required modules: $all_required_modules])
])
], [
AC_MSG_RESULT([no, $python3_version is too recent])
Expand Down Expand Up @@ -123,8 +135,9 @@ PyInit_spam(void)
])
AC_LANG_POP([C])
cat > conftest.py <<EOF
from distutils.core import setup
from distutils.extension import Extension

from $distutils_core import setup
from $distutils_extension import Extension
from sys import exit
modules = list((Extension("config_check_distutils", list(("conftest.c",))),))
setup(name="config_check_distutils", ext_modules=modules)
Expand Down Expand Up @@ -176,8 +189,9 @@ PyInit_spam(void)
])
AC_LANG_POP([C++])
cat > conftest.py <<EOF
from distutils.core import setup
from distutils.extension import Extension

from $distutils_core import setup
from $distutils_extension import Extension
from sys import exit
modules = list((Extension("config_check_distutils_cxx", list(("conftest.cpp",)),
extra_compile_args=list(("-std=c++11",)), language="c++"),))
Expand Down
2 changes: 1 addition & 1 deletion pkgs/sage-setup/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Mathematics",
]
urls = {Homepage = "https://www.sagemath.org"}
requires-python = ">=3.9, <3.12"
requires-python = ">=3.9, <3.13"
dependencies = []
dynamic = ["version"]

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.9, <3.12
python_requires = >=3.9, <3.13
install_requires =
SPKG_INSTALL_REQUIRES_sage_conf
SPKG_INSTALL_REQUIRES_six
Expand Down
Loading