sagemath/sage

Meta-ticket: Replace imports from deprecated distutils

mkoeppe opened this issue · 15 comments

distutils is marked deprecated in Python 3.10, 3.11 - see https://www.python.org/dev/peps/pep-0632/ and https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html?, which also lists some replacements

Tickets:

  • #30912 - switches sagelib setup.py from distutils to setuptools
  • #30984 sage_setup: Replace imports from distutils by setuptools
  • #31349 sage.misc.cython: Replace imports from distutils by setuptools
  • #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures setuptools to use its vendored distutils instead of stdlib distutils
  • #32565 sage.features.Executable: Remove global imports from distutils
  • #32873 sage.features, sage_setup: Replace use of distutils.errors by setuptools
  • #33065 Remove use of distutils.log
  • #33137

Other issues:

  • As we switch from distutils to setuptools for extension building, the tests for working distutils in python3/spkg-configure.m4 are no longer meaningful. Replaced by setuptools for Python >= 3.12 in #36983

CC: @fchapoton @kiwifb @tornaria

Component: python3

Issue created by migration from https://trac.sagemath.org/ticket/31295

Description changed:

--- 
+++ 
@@ -2,4 +2,4 @@
 
 Tickets:
 - #30984 sage_setup: Replace imports from distutils by setuptools
-
+- #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`

Description changed:

--- 
+++ 
@@ -1,5 +1,6 @@
 `distutils` is marked deprecated in Python 3.10, 3.11 - see https://www.python.org/dev/peps/pep-0632/, which also lists some replacements
 
 Tickets:
-- #30984 sage_setup: Replace imports from distutils by setuptools
+- #30984 `sage_setup`: Replace imports from distutils by setuptools
+- #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`

Description changed:

--- 
+++ 
@@ -4,3 +4,7 @@
 - #30984 `sage_setup`: Replace imports from distutils by setuptools
 - #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`
+
+Other issues:
+- As we switch from distutils to setuptools for extension building, the tests for working distutils in `python3/spkg-configure.m4` are no longer meaningful
+

Description changed:

--- 
+++ 
@@ -1,6 +1,7 @@
 `distutils` is marked deprecated in Python 3.10, 3.11 - see https://www.python.org/dev/peps/pep-0632/, which also lists some replacements
 
 Tickets:
+- #30912 - switches sagelib `setup.py` from distutils to setuptools
 - #30984 `sage_setup`: Replace imports from distutils by setuptools
 - #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`

Description changed:

--- 
+++ 
@@ -4,6 +4,7 @@
 - #30912 - switches sagelib `setup.py` from distutils to setuptools
 - #30984 `sage_setup`: Replace imports from distutils by setuptools
 - #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
+- #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures `setuptools` to use its vendored distutils instead of stdlib distutils
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`
 
 Other issues:
comment:7

The plan seems to be for removal in python 3.12. Somewhat connected, does sage depend on python packages that are in a somewhat abandoned state and therefore will just stop being buildable? Do we have some kind of audit?

comment:8

We just caught one such package that does not work with 3.9 in #31372.

The closest thing we have to an audit is upgrade tickets for python versions in alpha development state, such as #30766.

comment:9

Replying to @mkoeppe:

We just caught one such package that does not work with 3.9 in #31372.

The closest thing we have to an audit is upgrade tickets for python versions in alpha development state, such as #30766.

OK, I could have flagged pari_jupyter earlier, but I am more worried about packages sage_lib depends on. pari_jupyter not working is probably affecting a very small number of users and not an obstacle to sage itself. I guess in the back of my mind I see cysignals going out of maintenance since Jeroen disappeared. cypari has somewhat been rescued but could also be a concern.

comment:10

cysignals is likely going to be the biggest problem at some point. I see hints of trouble in #31350 (Julia package providing Sage) already

Description changed:

--- 
+++ 
@@ -5,6 +5,7 @@
 - #30984 `sage_setup`: Replace imports from distutils by setuptools
 - #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
 - #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures `setuptools` to use its vendored distutils instead of stdlib distutils
+- #32565 `sage.features.Executable`: Remove global imports from `distutils`
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`
 
 Other issues:

Description changed:

--- 
+++ 
@@ -6,6 +6,7 @@
 - #31349 `sage.misc.cython`: Replace imports from distutils by setuptools
 - #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures `setuptools` to use its vendored distutils instead of stdlib distutils
 - #32565 `sage.features.Executable`: Remove global imports from `distutils`
+- #32873 `sage.features`, `sage_setup`: Replace use of `distutils.errors` by `setuptools`
 - #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`
 
 Other issues:

Description changed:

--- 
+++ 
@@ -7,7 +7,6 @@
 - #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures `setuptools` to use its vendored distutils instead of stdlib distutils
 - #32565 `sage.features.Executable`: Remove global imports from `distutils`
 - #32873 `sage.features`, `sage_setup`: Replace use of `distutils.errors` by `setuptools`
-- #31296 `sage.features.Executable`: remove dependency on `distutils.spawn`
 
 Other issues:
 - As we switch from distutils to setuptools for extension building, the tests for working distutils in `python3/spkg-configure.m4` are no longer meaningful

Description changed:

--- 
+++ 
@@ -7,6 +7,7 @@
 - #31335 homebrew: Unused packages (singular, pari, ...) in /usr/local leak into sagelib build via distutils.cfg -- configures `setuptools` to use its vendored distutils instead of stdlib distutils
 - #32565 `sage.features.Executable`: Remove global imports from `distutils`
 - #32873 `sage.features`, `sage_setup`: Replace use of `distutils.errors` by `setuptools`
+- #33065 Remove use of `distutils.log`
 
 Other issues:
 - As we switch from distutils to setuptools for extension building, the tests for working distutils in `python3/spkg-configure.m4` are no longer meaningful

Description changed:

--- 
+++ 
@@ -8,6 +8,7 @@
 - #32565 `sage.features.Executable`: Remove global imports from `distutils`
 - #32873 `sage.features`, `sage_setup`: Replace use of `distutils.errors` by `setuptools`
 - #33065 Remove use of `distutils.log`
+- #33137 
 
 Other issues:
 - As we switch from distutils to setuptools for extension building, the tests for working distutils in `python3/spkg-configure.m4` are no longer meaningful

Description changed:

--- 
+++ 
@@ -1,4 +1,4 @@
-`distutils` is marked deprecated in Python 3.10, 3.11 - see https://www.python.org/dev/peps/pep-0632/, which also lists some replacements
+`distutils` is marked deprecated in Python 3.10, 3.11 - see https://www.python.org/dev/peps/pep-0632/ and https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html?, which also lists some replacements
 
 Tickets:
 - #30912 - switches sagelib `setup.py` from distutils to setuptools