Opened 21 months ago
Last modified 20 months ago
#29038 closed enhancement
Python package sage_conf: Provides optional configuration information for sagelib — at Version 21
Reported by:  mkoeppe  Owned by:  

Priority:  major  Milestone:  sage9.1 
Component:  build  Keywords:  
Cc:  fbissey, arojas, isuruf, embray, infinity0, ghtimokau, jdemeyer, dimpase, jhpalmieri, vbraun  Merged in:  
Authors:  Matthias Koeppe  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/mkoeppe/python_package_sage_conf__provides_optional_configuration_information_for_sagelib (Commits, GitHub, GitLab)  Commit:  f2863760bea085d285709ef848c53e6ce17a65fa 
Dependencies:  Stopgaps: 
Description (last modified by )
This ticket introduces a new Python package sage_conf
.
 sagethedistribution will generate this Python package at
./configure
time and install it at build time before starting to build/install sagelib usingsrc/setup.py
.  Distributions will generate and install their own
sage_conf
by a method of their choice before starting to build/install sagelib.
A console_script
allows to query individual variable values from the shell, or output all variables in .env format:
$ local/bin/sageconfig MAXIMA /Users/mkoeppe/s/sage/sagerebasing/worktreealgebraic2018spring/local/bin/maxima $ local/bin/sageconfig VERSION=9.1.beta0 MAXIMA=/Users/mkoeppe/s/sage/sagerebasing/worktreealgebraic2018spring/local/bin/maxima SAGE_LOCAL=/Users/mkoeppe/s/sage/sagerebasing/worktreealgebraic2018spring/local SAGE_ROOT=/Users/mkoeppe/s/sage/sagerebasing/worktreealgebraic2018spring
The module and the script are used as follows:
 It provides configuration information to sagelib at installation time (
src/setup.py
).
Ultimately we want to be able to install sagelib with
pip
. To support installation bypip
from PyPI, from an URL, etc., we cannot expect to configure the build like we do now, by writing the configuration to the filesrc/sageenvconfig
. Moreover, if pip is running inisolated
mode, also no environment variables are passed. Then the only information flow is through arguments topip build
and through the installed Python packages. By installingsage_conf
first, we make the configuration available to the pip install of sagelib.
 It provides configuration information to the docbuild, in particular about the install locations of documentation of external packages.
 It provides configuration information to the runtime of sagelib, making sagelib more independent from the environment variables set by
src/bin/sageenv
(local/bin/sageenv
).
 By providing
SAGE_LOCAL
as one the configuration variables, it removes assumptions regarding install locations ofsagelib
relative to$SAGE_LOCAL
. This enables the following:
 Installing an experimental version of
sagelib
in other install locations, such as in a user site packages directory.  Making
sagelib
available in a user's venv, as in the following example:
Without this ticket:
$ sage python m venv systemsitepackages ~/personalsagevenv/ $ source ~/personalsagevenv/bin/activate (personalsagevenv) $ python >>> import sage.env >>> sage.env.SAGE_LOCAL '/Users/mkoeppe/personalsagevenv' # wrong >>> import sage.all RuntimeError: You must get the file local/bin/sagemaxima.lispWith this ticket:
>>> sage.env.SAGE_LOCAL '/Users/mkoeppe/s/sage/sagerebasing/worktreealgebraic2018spring/local' >>> import sage.all >>> sage.all.maxima('1') 1
 For a broader context: see #21707 Task: Split
sageenv
into 5
Change History (21)
comment:1 Changed 21 months ago by
 Description modified (diff)
comment:2 Changed 21 months ago by
 Branch set to u/mkoeppe/python_package_sage_conf__provides_optional_configuration_information_for_sagelib
comment:3 Changed 21 months ago by
 Cc fbissey arojas isuruf embray infinity0 ghtimokau jdemeyer dimpase jhpalmieri added
 Commit set to fe5c890e66a7dd37395720b6c8e08a3837e5a74d
 Status changed from new to needs_review
comment:4 Changed 21 months ago by
 Commit changed from fe5c890e66a7dd37395720b6c8e08a3837e5a74d to aefd827981481f015c696328402278f2f8d30912
Branch pushed to git repo; I updated commit sha1. New commits:
aefd827  build/pkgs/sage_conf/spkginstall: Fix up path

comment:5 Changed 21 months ago by
why are you checking in files which apparently are meant to be generated from .in templates?
comment:6 Changed 21 months ago by
A mistake, which I will fix in a moment. Thanks!
comment:7 Changed 21 months ago by
 Commit changed from aefd827981481f015c696328402278f2f8d30912 to 88fd03c7784eb82eeb8cb06102ed4e93f5f1d758
comment:8 Changed 21 months ago by
 Description modified (diff)
comment:9 Changed 20 months ago by
 Description modified (diff)
comment:10 Changed 20 months ago by
 Description modified (diff)
comment:11 Changed 20 months ago by
 Description modified (diff)
comment:12 followup: ↓ 13 Changed 20 months ago by
the example with sage python m venv
 is it going to work if Sage is using venv on its own?
comment:13 in reply to: ↑ 12 Changed 20 months ago by
Replying to dimpase:
the example with
sage python m venv
 is it going to work if Sage is using venv on its own?
Not without installing sage packages into the new venv. As far as I can see, one can only control whether systempackages are made available but not whether the originating venv's packages are made available. But I'd expect that this option will be invented at some point in Python.
comment:14 Changed 20 months ago by
 Description modified (diff)
comment:15 followup: ↓ 16 Changed 20 months ago by
is sage_conf
also meant to be used while building Sage's dependencies?
comment:16 in reply to: ↑ 15 Changed 20 months ago by
comment:17 Changed 20 months ago by
author
ought to be either "The Sage Developers" (cf https://wiki.sagemath.org/Publications_using_SageMath?action=show&redirect=Publications_using_SAGE)
or yourself...
comment:18 followup: ↓ 19 Changed 20 months ago by
I copied the metadata from src/setup.py
comment:19 in reply to: ↑ 18 Changed 20 months ago by
Replying to mkoeppe:
I copied the metadata from
src/setup.py
that line is 5.5 years old. With all respect, William has not contributed a line of code to sagemath since 2017.
comment:20 Changed 20 months ago by
 Commit changed from 88fd03c7784eb82eeb8cb06102ed4e93f5f1d758 to f2863760bea085d285709ef848c53e6ce17a65fa
Branch pushed to git repo; I updated commit sha1. New commits:
f286376  build/pkgs/sage_conf/src/setup.cfg.in: Change author to 'The Sage Developers'

comment:21 Changed 20 months ago by
 Description modified (diff)
New commits:
29038: Python package sage_conf: Provides configuration information for sagelib