sage icon indicating copy to clipboard operation
sage copied to clipboard

Require Python 3.12 or newer; remove outdated workarounds

Open tobiasdiez opened this issue 3 months ago • 28 comments

In line with Spec 0, we remove support for Python 3.11. Many outdated patches/workarounds for these older (or even older) Python versions are removed, but I cannot guarantee that I've found all obsolete ones. Also CI tests for systems using Python 3.11 are removed.

For next years cleaning job:

  • Change version in pyproject.toml and build/pkgs/python3/spkg-configure.m4
  • Search for 3.12, 312,3,12, PY_VERSION, PY_MINOR_VERSION and sys.version_info

Similar PRs:

  • https://github.com/sagemath/sage/pull/39251

:memo: Checklist

  • [ ] The title is concise and informative.
  • [ ] 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.
  • [ ] I have updated the documentation and checked the documentation preview.

:hourglass: Dependencies

  • #39163

tobiasdiez avatar Sep 30 '25 17:09 tobiasdiez

Documentation preview for this PR (built with commit 6bb49a85687b177b46169b9d8f94dbfec5611a64; changes) is ready! :tada: This preview will update shortly after each push to this PR.

github-actions[bot] avatar Sep 30 '25 18:09 github-actions[bot]

Failure in the pdf docs seems to be unrelated (so are the other CI failures)

tobiasdiez avatar Nov 01 '25 02:11 tobiasdiez

You should delete 3.11 conda ci

cxzhong avatar Nov 01 '25 03:11 cxzhong

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

tobiasdiez avatar Nov 01 '25 03:11 tobiasdiez

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

In ci-meson.yml, you should delete the 3.11 conda ci

cxzhong avatar Nov 01 '25 06:11 cxzhong

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

In ci-meson.yml, you should delete the 3.11 conda ci

You need to delete

 include:
          # One run for oldest supported Python
          - os: 'ubuntu'
            python: '3.11'
            tests: 'all'

cxzhong avatar Nov 01 '25 08:11 cxzhong

@cxzhong

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

In ci-meson.yml, you should delete the 3.11 conda ci

You need to delete

 include:
          # One run for oldest supported Python
          - os: 'ubuntu'
            python: '3.11'
            tests: 'all'

will

--- a/.github/workflows/ci-meson.yml
+++ b/.github/workflows/ci-meson.yml
@@ -35,7 +35,7 @@ jobs:
         include:
           # One run for oldest supported Python
           - os: 'ubuntu'
-            python: '3.11'
+            python: '3.12'
             tests: 'all'
           # Test only changed files
           - os: 'ubuntu'

do?

dimpase avatar Nov 04 '25 15:11 dimpase

@cxzhong

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

In ci-meson.yml, you should delete the 3.11 conda ci

You need to delete

 include:
          # One run for oldest supported Python
          - os: 'ubuntu'
            python: '3.11'
            tests: 'all'

will

--- a/.github/workflows/ci-meson.yml
+++ b/.github/workflows/ci-meson.yml
@@ -35,7 +35,7 @@ jobs:
         include:
           # One run for oldest supported Python
           - os: 'ubuntu'
-            python: '3.11'
+            python: '3.12'
             tests: 'all'
           # Test only changed files
           - os: 'ubuntu'

do?

yes. Because in this PR, all conda lock files about python 3.11 are deleted. It is failed.

cxzhong avatar Nov 04 '25 15:11 cxzhong

also, how about removing build/pkgs/_python3.11/ ?

dimpase avatar Nov 04 '25 15:11 dimpase

also, how about removing build/pkgs/_python3.11/ ?

I do not know this. I think these files are not useful. But I can not confirm

cxzhong avatar Nov 04 '25 15:11 cxzhong

there is also build/pkgs/exceptiongroup/ overdue to remove, as it's only installed for Python version <3.11, see build/pkgs/exceptiongroup/version_requirements.txt exceptiongroup; python_version<"3.11"

dimpase avatar Nov 04 '25 15:11 dimpase

also to remove:

   importlib_metadata
   importlib_resources
   typing_extensions

according to build/pkgs/typing_extensions/spkg-configure.m4 and src/doc/en/developer/coding_in_python.rst

dimpase avatar Nov 04 '25 16:11 dimpase

also to remove:

   importlib_metadata
   importlib_resources
   typing_extensions

according to build/pkgs/typing_extensions/spkg-configure.m4 and src/doc/en/developer/coding_in_python.rst

typing_extensions is a dependency for newer version of beatifulsoup4. We can not remove this

cxzhong avatar Nov 04 '25 16:11 cxzhong

it might be listed in our settings as a dependency, but it's not even installed with python 3.12+, as far as I can see

dimpase avatar Nov 04 '25 17:11 dimpase

it might be listed in our settings as a dependency, but it's not even installed with python 3.12+, as far as I can see

Because in sage-distro We use a old version bs4. You can download the tar ball and look the pyproject.toml

cxzhong avatar Nov 04 '25 17:11 cxzhong

it might be listed in our settings as a dependency, but it's not even installed with python 3.12+, as far as I can see

Because in sage-distro We use a old version bs4. You can download the tar ball and look the pyproject.toml

I just checked this - sorry, you are right. Indeed they still use typing_extensions unconditionally (even in the master branch). Probably all typing_extensions there can be replaced by typing, but OK...

dimpase avatar Nov 04 '25 17:11 dimpase

@tobiasdiez Reslove conflict and merge the lastest develop please.

cxzhong avatar Nov 14 '25 06:11 cxzhong

change

# One run for oldest supported Python
          - os: 'ubuntu'
            python: '3.11'
            tests: 'all'

in ci-menson.yml

cxzhong avatar Nov 20 '25 05:11 cxzhong

@cxzhong

You should delete 3.11 conda ci

I think I did this already, but might have missed something. What do you mean precisely?

In ci-meson.yml, you should delete the 3.11 conda ci

You need to delete

 include:
          # One run for oldest supported Python
          - os: 'ubuntu'
            python: '3.11'
            tests: 'all'

will

--- a/.github/workflows/ci-meson.yml
+++ b/.github/workflows/ci-meson.yml
@@ -35,7 +35,7 @@ jobs:
         include:
           # One run for oldest supported Python
           - os: 'ubuntu'
-            python: '3.11'
+            python: '3.12'
             tests: 'all'
           # Test only changed files
           - os: 'ubuntu'

do?

You forget this @dimpase You just delete this. because we already have python3.12 Ubuntu test

cxzhong avatar Nov 20 '25 05:11 cxzhong

I have made a PR to this branch. Besides, can we remove check update-menson workflow?

cxzhong avatar Nov 20 '25 06:11 cxzhong

Then wait for CI agree this

cxzhong avatar Nov 20 '25 16:11 cxzhong

now I'm not 100% sure that [./tools/update-meson.py](https://github.com/sagemath/sage/pull/40936/commits/84f27b87a8df3ed752bd8b5532e0d10bb8fafd25) is correct thing for non-Conda installs, but let's see

dimpase avatar Nov 20 '25 23:11 dimpase

Tests are passing now, modulo the known random failures.

tobiasdiez avatar Nov 21 '25 16:11 tobiasdiez

I think the instructions from tools/update_meson should mention that they apply to Conda venvs only.

dimpase avatar Nov 21 '25 19:11 dimpase

Can we add python 3.14 support before the 10.8 stable version?

cxzhong avatar Nov 22 '25 05:11 cxzhong

I think the instructions from tools/update_meson should mention that they apply to Conda venvs only.

It's not conda specific. But the test that update_meson was run is only part of the conda tests.

tobiasdiez avatar Nov 22 '25 07:11 tobiasdiez

I think the instructions from tools/update_meson should mention that they apply to Conda venvs only.

It's not conda specific. But the test that update_meson was run is only part of the conda tests.

perhaps I'm not well-informed on the current coding practices, but are you saying that tools/update_meson must be run on every potential PR which changes a meson.build file? Is this documented?

dimpase avatar Nov 23 '25 15:11 dimpase

I think the instructions from tools/update_meson should mention that they apply to Conda venvs only.

It's not conda specific. But the test that update_meson was run is only part of the conda tests.

perhaps I'm not well-informed on the current coding practices, but are you saying that tools/update_meson must be run on every potential PR which changes a meson.build file? Is this documented?

If you add a python/cython file, it needs to be added to the meson file. This test is there to check that this was done.

tobiasdiez avatar Nov 24 '25 20:11 tobiasdiez