Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0a030c3
Update package versions and checksums for libffi, libpng, mpfr, ncurs…
cxzhong Oct 31, 2025
59f2c46
Fix: Add 'maxima' to the build-time dependencies of the Sage library
cxzhong Oct 31, 2025
1ab99a3
Configure readline to link ncurses explicitly
cxzhong Nov 1, 2025
2bf74eb
Merge branch 'develop' into Bump-Python
cxzhong Nov 12, 2025
c31e5f0
Merge branch 'develop' into Bump-Python
cxzhong Feb 2, 2026
ba00dfb
Merge branch 'pr-41576' into Bump-Python
cxzhong Feb 3, 2026
85c1305
Delete python packages
cxzhong Feb 3, 2026
c5571c8
Refactor distutils checks to use conftest.dir for temporary files and…
cxzhong Feb 3, 2026
b940030
Remove distros without Python 3.12+ from CI
cxzhong Feb 3, 2026
0578b54
Add python3-setuptools to distro prereqs for Python 3.12+ support
cxzhong Feb 3, 2026
3db197c
Add python3-dev/python3-devel to distro prereqs
cxzhong Feb 3, 2026
f48b789
Add centos-stream-10 to CI distro list
cxzhong Feb 3, 2026
387846e
Update Fedora versions from 40/41 to 42/43 in CI
cxzhong Feb 3, 2026
e7c7405
Install setuptools for Python 3.13 on macOS CI
cxzhong Feb 3, 2026
b0f4ff7
Bump openssl to 3.5.5 and xz to 5.8.2
cxzhong Feb 3, 2026
3879725
Update cmdline tests to remove references to deleted sqlite package
cxzhong Feb 3, 2026
49a2458
Add ubuntu-resolute and debian-trixie to CI workflow and tox environm…
cxzhong Feb 3, 2026
e304978
Add Python packages to _bootstrap distros and restore linux-minimal C…
cxzhong Feb 3, 2026
471fd54
Initial plan
Copilot Feb 3, 2026
7142c11
Bump libpng to 1.6.53
Copilot Feb 3, 2026
9778fa7
Merge pull request #11 from cxzhong/copilot/bump-libpng-version
cxzhong Feb 3, 2026
41fd149
Bump ncurses to 6.6
cxzhong Feb 4, 2026
e087864
Update upstream URL for ncurses in checksums.ini
cxzhong Feb 4, 2026
ef52874
Update upstream URL for ncurses in checksums.ini
cxzhong Feb 4, 2026
f1a57b6
Nopy (#13)
dimpase Feb 13, 2026
46a6843
Merge branch 'develop' into Bump-Python
cxzhong Feb 13, 2026
9402961
revert
cxzhong Feb 13, 2026
9fc46c3
Update checksums and upstream URL for libpng
cxzhong Feb 13, 2026
8d059da
Update libffi package version to 3.5.2
cxzhong Feb 13, 2026
63484c5
Update libpng version from 1.6.53 to 1.6.55
cxzhong Feb 13, 2026
acfcb07
Update checksums for libpng tarball
cxzhong Feb 13, 2026
d021e97
removed xz and libzlma spkgs, docs fixed (#14)
dimpase Feb 13, 2026
31659ad
remove $PYTHON (almost) (#15)
dimpase Feb 15, 2026
b3bd090
Add primecount package to Debian dependencies
cxzhong Feb 15, 2026
ec8768d
Update SPKG.rst to include detailed installation instructions for XZ …
cxzhong Feb 17, 2026
fe2feda
Update SPKG.rst to enhance installation instructions for XZ Utils and…
cxzhong Feb 18, 2026
13dfaf6
Update SPKG.rst to include setuptools as a required Python module
cxzhong Feb 18, 2026
ab7c4d7
Merge branch 'develop' into Bump-Python
cxzhong Feb 27, 2026
6a69941
Documentation
cxzhong Mar 17, 2026
54947e7
Update compiler requirements in documentation for clarity
cxzhong Mar 17, 2026
ebf9683
clean up readme.md
cxzhong Mar 18, 2026
1b1f88d
Update documentation to reflect changes in Python requirements and usage
cxzhong Mar 18, 2026
6cab648
Merge branch 'develop' into Bump-Python
cxzhong Mar 23, 2026
e3cd73e
resolve conflict
cxzhong Apr 5, 2026
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
6 changes: 5 additions & 1 deletion .github/workflows/ci-distro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
targets: build
targets_optional: ptestlong
tox_system_factors: >-
["ubuntu-jammy"]
["ubuntu-noble"]
tox_packages_factors: >-
["minimal"]
docker_push_repository: ghcr.io/${{ github.repository }}/
Expand Down Expand Up @@ -89,6 +89,10 @@ jobs:
with:
python-version: "3.13"

- name: Install Python packages
run: |
pip install setuptools

- name: Install dependencies
run: |
eval $(build/bin/sage-print-system-package-command homebrew update)
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ on:
description: 'Stringified JSON object listing tox system factors'
type: string
# 'tox -e update_docker_platforms' updates below
# Only distros with Python 3.12+ are supported (Sage now requires system Python 3.12+)
default: >-
[
"ubuntu-jammy",
"ubuntu-noble",
"debian-bullseye",
"debian-bookworm",
"fedora-40",
"fedora-41",
"centos-stream-9",
"ubuntu-resolute",
"debian-trixie",
"fedora-42",
"fedora-43",
"centos-stream-10",
"opensuse-tumbleweed",
]
# 'tox -e update_docker_platforms' updates above
Expand Down Expand Up @@ -280,4 +280,4 @@ jobs:
else
echo "No Docker images created."
fi
if: always() && ${{ inputs.docker_push_repository }}
if: ${{ always() && inputs.docker_push_repository }}
55 changes: 38 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Table of Contents
* [Build System](#build-system)
* [Relocation](#relocation)
* [Redistribution](#redistribution)
* [Build System](#build-system)
* [Changes to Included Software](#changes-to-included-software)

Getting Started
Expand Down Expand Up @@ -210,8 +209,9 @@ in the Installation Guide.

4. [Linux, WSL] Install the required minimal build prerequisites:

- Compilers: `gcc`, `gfortran`, `g++` (GCC versions from 8.4.0 to 13.x
and recent versions of Clang (LLVM) are supported).
- Compilers: `gcc`, `gfortran`, `g++`, or other suitable C, C++, and
Fortran compilers. Sage's classical build checks for a C compiler that
can compile C99 code and a C++ compiler with C++11 support.
See [build/pkgs/gcc/SPKG.rst](build/pkgs/gcc/SPKG.rst) and
[build/pkgs/gfortran/SPKG.rst](build/pkgs/gfortran/SPKG.rst)
for a discussion of suitable compilers.
Expand All @@ -221,11 +221,14 @@ in the Installation Guide.
See [build/pkgs/_prereq/SPKG.rst](build/pkgs/_prereq/SPKG.rst) for
more details.

- Python 3.4 or later, or Python 2.7, a full installation including
`urllib`; but ideally version 3.12.x or later, 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.
- Python 3.12 or newer with a full standard library installation.
Sage no longer builds its own copy of Python; you must provide a
system Python or another external Python installation.
Sage's `./configure` currently requires Python `>= 3.12` and `< 3.15`,
with modules including `sqlite3`, `ctypes`, `math`, `hashlib`,
`socket`, `ssl`, `ensurepip`, and `zlib`.
See the [installation guide](https://doc.sagemath.org/html/en/installation/source-distro.html#using-an-external-python-installed-by-uv)
for details on using a system or `uv`-managed Python.

We have collected lists of system packages that provide these build
prerequisites. See, in the folder
Expand Down Expand Up @@ -363,6 +366,20 @@ in the Installation Guide.
For example, to build Sage with `gf2x` package supplied by Sage,
use `./configure --with-system-gf2x=no`.

Sage no longer builds its own copy of Python, so `./configure` must
find a suitable external interpreter. If you want to use a Python
installed with `uv` instead of your system package manager's Python,
Sage's `./configure` check currently expects Python `>= 3.12` and
`< 3.15`. On Python 3.12 and newer, it also requires `setuptools`,
because the configure test creates a fresh virtual environment from
the selected interpreter and builds small extension modules there.
For a `uv`-managed Python, one working setup is:

$ uv python install 3.13
$ PYTHON3="$(uv python find --managed-python --resolve-links 3.13)"
$ uv pip install --python "$PYTHON3" --break-system-packages setuptools
$ ./configure --with-python="$PYTHON3"

At the end of a successful `./configure` run, you may see messages
recommending to install extra system packages using your package
manager.
Expand Down Expand Up @@ -486,6 +503,7 @@ SAGE_ROOT Root directory (create by git clone)
├── configure Top-level configure script
├── COPYING.txt Copyright information
├── local (SAGE_LOCAL) Installation hierarchy for non-Python packages
│ and shared runtime files
│ ├── bin Executables
│ ├── include C/C++ headers
│ ├── lib Shared libraries, architecture-dependent data
Expand Down Expand Up @@ -541,9 +559,13 @@ and its associated user interfaces, and the larger software distribution of
Sage's main dependencies (for those dependencies not supplied by the user's
system).

Sage's Python library is built and installed using a `setup.py` script as is
standard for Python packages (Sage's `setup.py` is non-trivial, but not
unusual).
Sage no longer builds its own Python interpreter. Instead, `./configure`
selects a system or other external Python (`>= 3.12`, `< 3.15`) and uses it
to create `SAGE_VENV`.

Sage's Python library is built and installed as a standard Python project via
`pip install .`, using the metadata in `pyproject.toml` and the
`meson-python` build backend.

Most of the rest of the build system is concerned with building all of Sage's
dependencies in the correct order in relation to each other. The dependencies
Expand All @@ -567,18 +589,18 @@ The `configure` script itself, if it is not already built, can be generated by
running the `bootstrap` script (the latter requires _GNU autotools_ being installed).
The top-level `Makefile` also takes care of this automatically.

To summarize, running a command like `make python3` at the top-level of the
To summarize, running a command like `make sagelib` at the top-level of the
source tree goes something like this:

1. `make python3`
1. `make sagelib`
2. run `./bootstrap` if `configure` needs updating
3. run `./configure` with any previously configured options if `build/make/Makefile`
needs updating
4. change directory into `build/make` and run the `install` script--this is
little more than a front-end to running `make -f build/make/Makefile python3`,
little more than a front-end to running `make -f build/make/Makefile sagelib`,
which sets some necessary environment variables and logs some information
5. `build/make/Makefile` contains the actual rule for building `python3`; this
includes building all of `python3`'s dependencies first (and their
5. `build/make/Makefile` contains the actual rule for building `sagelib`; this
includes building all of `sagelib`'s dependencies first (and their
dependencies, recursively); the actual package installation is performed
with the `sage-spkg` program

Expand Down Expand Up @@ -629,4 +651,3 @@ part of the Sage git repository.
<p align="center">
https://www.sagemath.org
</p>

78 changes: 0 additions & 78 deletions build/bin/sage-bootstrap-python

This file was deleted.

2 changes: 1 addition & 1 deletion build/bin/sage-build-num-threads
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3
#
# Determine the number of threads to be used by Sage.
#
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-download-file
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3

# USAGE:
#
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-flock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3
# vim: set filetype=python:

# USAGE:
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-print-system-package-command
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function print_shell_command()
if [ -z "$WRAP" -o $# -lt 6 ]; then
echo "${PROMPT}${quoted}"
else
sage-bootstrap-python -c "import textwrap; print(' \\\\\n'.join(textwrap.wrap(r'''${quoted}''', $WRAP, initial_indent=r'''${PROMPT}''', subsequent_indent=r'''${CONTINUATION}''', break_long_words=False, break_on_hyphens=False)))"
python3 -c "import textwrap; print(' \\\\\n'.join(textwrap.wrap(r'''${quoted}''', $WRAP, initial_indent=r'''${PROMPT}''', subsequent_indent=r'''${CONTINUATION}''', break_long_words=False, break_on_hyphens=False)))"
fi
if [ -n "$OUTPUT_RST" ]; then
echo
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-spkg-installcheck
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3

# usage: sage-spkg-installcheck [-h] PKG [SAGE_LOCAL]
#
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-spkg-uninstall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3

# usage: sage-spkg-uninstall [-h] PKG [SAGE_LOCAL]
#
Expand Down
2 changes: 1 addition & 1 deletion build/bin/sage-uncompress-spkg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sage-bootstrap-python
#!/usr/bin/env python3

# usage: sage-uncompress-spkg [-h] [-d DIR] PKG [FILE]
#
Expand Down
11 changes: 2 additions & 9 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ SPKG_INST_RELDIR = var/lib/sage/installed

# Aliases for mutually exclusive standard packages selected at configure time
TOOLCHAIN = @SAGE_TOOLCHAIN@
PYTHON = python3
MP_LIBRARY = gmp
BLAS = openblas

Expand Down Expand Up @@ -221,12 +220,7 @@ ifneq ($(PYTHON_FOR_VENV),)
# 3 only). $(PYTHON) is set in Makefile to python3_venv.
# Thus $(inst_python3_venv) will an (order-only) dependency of every Python package.
#
# TODO: If we reconfigure to build our own Python after having used the system
# Python, files installed to create the virtualenv should be *removed*. That
# could either be done here by the makefile, or in an spkg-preinst for python3
ifeq ($(PYTHON),python3)
PYTHON = python3_venv
endif
inst_python3_venv = $(SAGE_VENV)/$(SPKG_INST_RELDIR)/python3_venv-3.$(PYTHON_MINOR)-$(subst /,-,$(PYTHON_FOR_VENV))$(findstring --system-site-packages,$(SAGE_VENV_FLAGS))

$(SAGE_VENV)/$(SPKG_INST_RELDIR):
Expand Down Expand Up @@ -313,9 +307,8 @@ all-toolchain: base-toolchain
PYTHON_TOOLCHAIN = setuptools pip setuptools_scm wheel flit_core hatchling python_build meson_python

# Issue #32056: Avoid installed setuptools leaking into the build of python3 by uninstalling it.
# It will have to be reinstalled anyway because of its dependency on $(PYTHON).
python3-SAGE_LOCAL-no-deps: setuptools-clean
python3-SAGE_VENV-no-deps: setuptools-clean
# python3-SAGE_LOCAL-no-deps: setuptools-clean
# python3-SAGE_VENV-no-deps: setuptools-clean

# Everything needed to start up Sage using "./sage". Of course, not
# every part of Sage will work. It does not include Maxima for example.
Expand Down
47 changes: 47 additions & 0 deletions build/pkgs/_bootstrap/SPKG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,50 @@ Description
This optional script package represents the requirements (system packages)
that are needed in addition to those represented by the ``_prereq`` package
in order to run the top-level ``bootstrap`` script.

Namely, the following standard tools must be installed on your computer:

- **liblzma/xz**: XZ Utils, the free general-purpose data compression software
with a high compression ratio.
- **python**: Python 3.12 or later from your system package manager or another
external installation. Sage no longer builds its own Python interpreter; it
uses this interpreter to create ``SAGE_VENV``. It needs to have the
development headers and the following standard modules available:
sqlite3, ctypes, math, hashlib, socket, ssl, ensurepip, zlib, setuptools

XZ Utils (liblzma) is available with most supported distributions (package
names such as ``xz-devel`` on Fedora, ``liblzma-dev`` on Debian/Ubuntu).
It can also be built from source from https://github.com/tukaani-project/xz.
After downloading and untarring the release archive, and changing to the
directory with the sources::

$ ./configure --prefix=/usr/local && make && make install

will install XZ Utils in ``/usr/local``. Instead of ``/usr/local`` one may choose
another location, say ``/opt/foo``. A modern xz/liblzma installs a
``liblzma.pc`` file, and Sage's ``./configure`` checks for it using a
pkg-config macro. To detect xz/liblzma at a non-standard location, add it
to ``PKG_CONFIG_PATH``::

$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/foo/lib/pkgconfig

Python 3.12 (or later) with development headers is available with most
supported distributions (package names such as ``python3-devel`` on Fedora,
``python3-dev`` on Debian/Ubuntu).
It can also be built from source from https://www.python.org/downloads/.
After downloading and untarring the release archive, and changing to the
directory with the sources::

$ ./configure --prefix=/usr/local --enable-optimizations --with-ensurepip=install && make && make install

will install Python in ``/usr/local``; this takes a few minutes on a
moderately fast machine. Instead of ``/usr/local`` one may choose another
location, say ``/opt/foo``, which then should be passed to Sage's
``./configure`` with ``--with-python=/opt/foo/bin/python3``.
The ``--enable-optimizations`` flag is optional but recommended for
performance. Make sure that the prerequisites for the required standard
modules (``sqlite3``, ``ctypes``, ``zlib``, ``ssl``, etc.) are installed
before building Python; otherwise these modules will be missing.

It is also possible to use a Python installed by `uv <https://docs.astral.sh/uv/>`_
and pass it to ``./configure`` with ``--with-python=...``.
6 changes: 6 additions & 0 deletions build/pkgs/_bootstrap/distros/alpine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ gettext-dev
autoconf
automake
libtool
# Python packages needed for configure and build
python3
python3-dev
py3-setuptools
xz
xz-dev
4 changes: 4 additions & 0 deletions build/pkgs/_bootstrap/distros/arch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
autoconf
automake
libtool
# Python packages needed for configure and build
python
python-setuptools
xz
5 changes: 5 additions & 0 deletions build/pkgs/_bootstrap/distros/conda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
autoconf
automake
libtool
# Python packages needed for configure and build
python
setuptools
xz
xz
Loading
Loading