Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta-ticket: Split sage-env into 5 to clean up sage configuration #21707

Open
mkoeppe opened this issue Oct 15, 2016 · 65 comments
Open

Meta-ticket: Split sage-env into 5 to clean up sage configuration #21707

mkoeppe opened this issue Oct 15, 2016 · 65 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Oct 15, 2016

src/bin/sage-env (with generated configuration in src/bin/sage-env-config; installed in $SAGE_LOCAL/bin) is used in all of the following contexts:

  1. Sage-the-distribution while building spkgs,
  2. Sage-the-distribution for building sagelib,
  3. for environment variables needed to start Sage,
  4. as variables by Sage at runtime (through sage.env), and
  5. for environment variables affecting subprocesses of Python invoked by sagelib modules.

This ticket proposes to split the configuration according to these 5 contexts. This will make the installation of Sage more modular and flexible.

1./2. Create build/bin/sage-build-env(with generated configuration in build/bin/sage-build-env-config) for the build-time environment variables for sage-the-distribution (spkg and sagelib). It is not installed in $SAGE_LOCAL.
b. In build/make/Makefile.in and the scripts generated by build/bin/sage-spkg, source build/bin/sage-build-env in addition to src/bin/sage-env. This is #29052.
c. Gradually, we will move settings from src/bin/sage-env[-config] to build/bin/sage-build-env[-config] that are known to be only needed for 1./2. (Note that not all compiler-related environment variables can be moved exclusively to 1./2. – some need to be added to 5 as well for some some calls to compilers needed at runtime to support things like %cython (?) and sage.calculus.desolvers.desolve_mintides.) As well as users' use of pip to install additional Python packages!
d. Eventually, we will remove the call to src/bin/sage-env from the build scripts.

2./3. Obtain sagelib's build-time configuration such as src/setup.py's library_dirs and runtime information (sage.env) from sage-config (introduced in #29038).
a. In src/Makefile, poison the SAGE_LOCAL variable.

3./4./5. Using sage_conf (Python module and script sage-config, #29038), make sage.all fully functional when imported from a Python, without setting any environment variables (sage-env).
a. Initially, phase out src/bin/sage-env-config by using sage-config instead.

Aspects of downstream sage packaging:

Binary packages:

pip-installable Sage

More related tickets:

Depends on #29038
Depends on #29052

CC: @embray @jdemeyer @nexttime @kiwifb @dimpase @isuruf @antonio-rojas @infinity0 @timokau @orlitzky @jhpalmieri @tobiasdiez

Component: build

Keywords: sd109

Author: Matthias Koeppe

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

@mkoeppe mkoeppe added this to the sage-7.5 milestone Oct 15, 2016
@kiwifb
Copy link
Member

kiwifb commented Oct 15, 2016

comment:1

One comment. Currently sage_setup is installed because it needs to be installed to be doctested - like the rest of sage. But nothing in sage_setup is really needed at runtime and distro can choose not to install it. I don't in sage-on-gentoo. I tend to push for thing not needed at runtime to be moved in there. And that's where I would have put sage-build-env but I am not going to fight it going into build/bin although I'd like everything used by setup.py to be neatly under src.

@mkoeppe
Copy link
Member Author

mkoeppe commented Oct 15, 2016

comment:2

Thanks - I've updated the description

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@embray
Copy link
Contributor

embray commented Oct 17, 2016

comment:4

I agree.

Consider a slight alternative: Rewrite sage-env as a Python script. This would give it much more flexibility and probably more legibility, including some command-line options for different environments (--build, especially).

The output would of course be the shell commands to actually set the variables. So rather than source sage-env one would eval $(sage-env). My one concern is that it would be slower, but ideally it's something that shouldn't happen frequently anyways, but rather only when not already in sage-env.

@kiwifb
Copy link
Member

kiwifb commented Oct 17, 2016

comment:5

I have a tendency to mix up sage-env the script and sage.env.py, my comment is really an example of that. However a lot is common between the two.

@embray
Copy link
Contributor

embray commented Oct 17, 2016

comment:6

Right--they could be one in the same.

@kiwifb
Copy link
Member

kiwifb commented Oct 17, 2016

comment:7

Replying to @embray:

Right--they could be one in the same.

I have thought about it often. Of course that really means that you'll have to removing all the build time stuff. But in sage-on-gentoo where I ship a very simplified sage-env (in /etc as well) they are virtually doing the same thing, one in shell, the other in python.

@embray
Copy link
Contributor

embray commented Oct 17, 2016

comment:8

In either case--whether making a single script, or two separate shell scripts, this would be useful for gentoo (and probably other distros as well) then right?

@kiwifb
Copy link
Member

kiwifb commented Oct 17, 2016

comment:9

Probably, the current sage-env is a forest mostly dedicated to the build system. I just discard it and bring my own, it takes less space and maintenance than a mega patch.

@mkoeppe
Copy link
Member Author

mkoeppe commented Oct 17, 2016

comment:10

Ideally, the configuration for sagelib runtime should take place in a generated Python file and not involve environment variables at all.

@embray
Copy link
Contributor

embray commented Oct 17, 2016

comment:11

More likely parts of it would be static, and other parts could be generated, but yes, what I meant above in terms of rewriting sage-env in Python was that it would not (by default) involve environment variables at all.

But it's still useful for interacting with other tools, especially for build purposes, as well as dropping into ./sage -sh to be able to set environment variables, which is why I suggest a mode to output a list of variables that can be read from the shell.

@mkoeppe
Copy link
Member Author

mkoeppe commented May 20, 2019

@mkoeppe
Copy link
Member Author

mkoeppe commented May 20, 2019

Commit: 9189d60

@mkoeppe
Copy link
Member Author

mkoeppe commented May 20, 2019

Dependencies: #25130

@mkoeppe
Copy link
Member Author

mkoeppe commented May 20, 2019

New commits:

7405dd5Move sage-dist-helpers from src/bin to build/bin
9189d60Split out build/bin/sage-build-env-config from sage-env-config

@mkoeppe
Copy link
Member Author

mkoeppe commented May 20, 2019

Author: Matthias Koeppe

@mkoeppe mkoeppe modified the milestones: sage-7.5, sage-8.8 May 20, 2019
@embray
Copy link
Contributor

embray commented May 21, 2019

comment:14

As-is this is going to conflict with tickets like #27825 that are adding still more environment variables needed at build-time to sage-env-config.

I'm completely in favor of this separation in principle though. The question is whether we should do this first and then update tickets like #27825 on top of it, or the other way around?

@dimpase
Copy link
Member

dimpase commented May 21, 2019

comment:15

I really would like to first get our existing tickets (#27825, #27822) touching sage-env-config in.

@mkoeppe
Copy link
Member Author

mkoeppe commented May 22, 2019

comment:16

The tickets would be trivial to rebase on top of this one.

@mkoeppe
Copy link
Member Author

mkoeppe commented May 23, 2019

comment:17

Probably one should introduce a command sage --buildsh, which would provide the larger environment.

@embray
Copy link
Contributor

embray commented Jul 1, 2019

comment:18

For the sake of a bit more terseness I wonder if we could call it just sage-env-build.in and sage-env-build. The only reason for the -config in the other one is to distinguish it from plain sage-env.

Now that I look I'm not even entirely sure we need to separate sage-env-config from sage-env.

I think we could probably have a sage-env.in produce sage-env and get rid of the separate sage-env-config entirely, though it's possible there's some subtlety to that that I'm missing.

@embray
Copy link
Contributor

embray commented Jul 1, 2019

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 5, 2021

comment:59

From the discussion in #32904 regarding sage_conf at build time (with pip's build isolation) vs. runtime:

@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 5, 2021

comment:60

From #32904 comment:24:

  • Split sage-conf into build and runtime configuration. There is still an overlap (and thus duplication) but at built time sage needs less dependencies than at runtime. In addition, maybe directly incorporate the build-time sage-conf in the sagemath package.

@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 5, 2021

comment:61

Replying to @mkoeppe:

From gh-tobiasdiez in #32904 comment:24:

  • Split sage-conf into build and runtime configuration. There is still an overlap (and thus duplication) but at build time sage needs less dependencies than at runtime. In addition, maybe directly incorporate the build-time sage-conf in the sagemath package.

I think this is an interesting direction

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 2, 2022
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.8, sage-9.9 Jan 7, 2023
@mkoeppe mkoeppe modified the milestones: sage-10.0, sage-10.1 Apr 30, 2023
@mkoeppe mkoeppe removed this from the sage-10.1 milestone Aug 7, 2023
@mkoeppe mkoeppe mentioned this issue Mar 22, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants