Skip to content

Modularization of sagelib: Break out separate packages sagemath-environment, sagemath-repl #29941

@mkoeppe

Description

@mkoeppe

The distribution sagemath-environment has no dependencies and contains:

It also includes the top-level scripts sage and sage-env, and the helper script sage-venv-config. This will allow users to run sage -sh even if sagelib is not installed.

To test:

$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-environment && SAGE_NUM_THREADS=16 tox -r -v -v -v -e py39)'

The distribution sagemath-repl depends on (install-requires) sagemath-environment and sagemath-objects and contains at least the following:

  • sage.repl
  • sage.doctest (which depends on sage.repl)
  • sage.misc.sage_input
  • sage.misc.sage_eval

It also includes scripts such as sage-runtests (which implements sage -t), sage-ipython (which is called when sage is invoked with no arguments), etc.

Of course, with nothing else installed, neither sage -t nor sage will work fully because sage.all is not available. But sage -t already has the option --environment for specifying a different top-level module in which to run the doctester; we use this in the test suite of sagemath-objects and sagemath-polyhedra (#32432).

To test:

$ ./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-repl && SAGE_NUM_THREADS=16 tox -r -v -v -v -e py39)'

Afterwards:

$ source pkgs/sagemath-repl/.tox/py39/bin/activate
(py39) $ sage                                                                                        
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.6.rc3, Release Date: 2022-04-29                 │
│ Using Python 3.9.10. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┃ Warning: sage.all is not available; this is a limited REPL.        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage:                                                                                                                                                                                                                       

Note the new warning about sage.all.

We also change all pkgs/*/VERSION.txt files from symlinks to regular files, updated by sage-update-version when a new release is made. This makes it easier to cut post-versions such as 9.6.rc3.post4 or dev versions such as 9.6.rc4.dev1, as was necessary during the development of this ticket. See documentation added in this ticket.

Follow-ups (see Meta-ticket #29705):

Depends on #33797
Depends on #33016
Depends on #33799
Depends on #33801
Depends on #33803

CC: @kwankyu @tobiasdiez @kliem @orlitzky @dimpase @jhpalmieri @kiwifb

Component: refactoring

Keywords: sd111

Author: Matthias Koeppe

Branch/Commit: 3884373

Reviewer: Dima Pasechnik

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions