Description
This is a follow-up from #28225 - "Allow sage to run in the absence of sage-env
". The present ticket also allows $SAGE_LOCAL/bin/python
to run and import sage.all
in the absence of the shell script sage-env
. (Getting a fully functional sage.all
is future work.)
This ticket also makes sagelib more independent from the environment variables set by src/bin/sage-env
(local/bin/sage-env
), and to remove assumptions regarding install locations of sagelib relative to $SAGE_LOCAL
.
-
To support users who want to install an experimental version of sagelib in other install locations, such as in a user site packages directory.
-
For making sagelib available in a user's venv, as in the following example:
Without this ticket:$ sage -python -m venv --system-site-packages ~/personal-sage-venv/ $ source ~/personal-sage-venv/bin/activate (personal-sage-venv) $ python >>> import sage.env >>> sage.env.SAGE_LOCAL '/Users/mkoeppe/personal-sage-venv' # wrong >>> import sage.all RuntimeError: You must get the file local/bin/sage-maxima.lisp
With this ticket:
>>> sage.env.SAGE_LOCAL '/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local' >>> import sage.all >>> sage.all.maxima('1') 1
-
To support Add configure option --with-sage-venv=SAGE_VENV to create venv there instead of in SAGE_LOCAL #29013/spkg-configure.m4 for python3 #27824: spkg-configure.m4 for python3
-
To make it possible for distributions to use a stock
src/sage/env.py
(providing a customsrc/sage/env_conf.py
).
In a first step, we just set SAGE_LOCAL
and MAXIMA
(to the location of the maxima
binary), but also SAGE_ROOT
could be added (for developer conveniences such as sage.misc.edit_module; see also #25486); and later packages' spkg-configure
might be setting MATHJAX_DIR
etc.
In a follow-up ticket, src/sage/env_config.py
would actually be generated by src/setup.py
, not configure
.
Ticket #29038 provides an alternative implementation that uses an standalone installed Python module sage_conf
, rather than writing into src/sage
Related:
- Meta-ticket: Split sage-env into 5 to clean up sage configuration #21707: Split sage-env into sage-build-env and sage-env
- Add a plain-text config file that feeds into sage.env #22652: Add a plain-text config file that feeds into sage.env
- Meta-ticket: Make sagelib a pip-installable Python source package, listed on PyPI #21507: Task ticket: Make sagelib a pip-installable Python source package, listed on PyPI
CC: @kiwifb @antonio-rojas @isuruf @embray @infinity0 @timokau @jdemeyer @dimpase @jhpalmieri
Component: build
Author: Matthias Koeppe
Branch/Commit: u/mkoeppe/create_module_src_sage_env_config_py_from_src_sage_env_config_py_in__defining_variables_for_use_in_sage_env @ 7a43544
Reviewer: Dima Pasechnik, Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/29022