-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Make sagelib installation directory more flexible by creating a module src/sage/env_config.py from src/sage/env_config.py.in, defining variables for use in sage.env #29022
Comments
This comment has been minimized.
This comment has been minimized.
Commit: |
Author: Matthias Koeppe |
New commits:
|
comment:5
Interesting concept. But your branch won't achieve much since |
comment:6
Replying to @kiwifb:
|
comment:7
But yes, let's add |
comment:8
I misunderstood the way the code works in
I removed However
I don't particularly need |
comment:9
Replying to @kiwifb:
Yes, I agree that SAGE_ROOT is not very important, but it's still used for developer convenience functions like those in |
comment:10
Replying to @mkoeppe:
Almost all of the |
comment:11
Note |
comment:12
Replying to @mkoeppe:
I made sure of that :) - so if |
comment:13
I don't see why it needs to explicitly be a Python module. I think my proposal in #22652 is simpler, because the same file could be used both for configuring the shell environment, and can be read by the Python code. To me this just seems like extra cruft. |
comment:14
Replying to @mkoeppe:
|
comment:15
Replying to @embray:
For example, a file like this could be generated at build time by running something like:
It could be output to a .py module that's (optionally) imported by |
comment:16
Replying to @embray:
Thanks for this useful info. The purpose of this ticket, however, is to get rid of assumptions like that, to enable use of system python, see #27824. |
comment:17
Yeah, I see what you're saying. Long term I think it would be great if we could get rid of "SAGE_LOCAL" altogether, though I'm not exactly sure what the alternative looks like either... |
comment:19
Needs review. |
comment:20
Sorry, I'm just not convinced this is useful. At least not yet. It's not needed for setting SAGE_LOCAL. I do agree something like this might be useful for setting other paths related to Sage's dependencies, but I don't think that's necessarily something that should be output by a configure script either, but rather should be loaded from a config file that downstream packagers can modify without patching if need be. To expand on that a bit, the sage-the-distribution configure script is not generally run by packagers. Instead, this should be handled at the level of the sagelib package itself. |
comment:21
Replying to @embray:
Sage-the-distribution generates the file using configure script. Downstream packagers would generate the file by any means that they prefer. |
comment:22
Replying to @mkoeppe:
If that's the case, I don't think |
This comment has been minimized.
This comment has been minimized.
comment:39
Replying to @embray:
In #29038 I now do exactly that. Thanks for the input. |
comment:40
This ticket is superseded by #29038 - Python package |
Reviewer: Dima Pasechnik, Erik Bray |
comment:42
Replying to @mkoeppe:
I'm sorry, what you did in that ticket is not what I meant at all, and that's my fault for not being clearer and more explicit. What I had in mind here was this:
An analogy I would use is I'm still -1 on it being a .py module, but if you feel strongly about that I'd take it as long as we can do the rest more like Numpy does. |
comment:43
numpy's configuration/setup is IMHO a good example of how NOT to do such things. |
comment:44
Replying to @embray:
Numpy's solution, expecting a configuration file in its to-be-installed sources, is outdated (and, by the way, untested by upstream) because it is incompatible with pip-installing from a source other than a local directory. Let's continue the discussion in #29038. |
comment:45
This ticket can now be closed because superseded by #29038. |
comment:48
Replying to @mkoeppe:
I dont think so; you could also pass the configuration by other means but it's just an example. I don't see how #29038 makes this any better. Now you have to have a whole external Python module to do the same thing. |
comment:49
wrapping up configuration into a Python package is more Pythonic than "other means". "A whole external Python" module is way cleaner than a bunch of text files (maybe sourceable from shell, maybe not) for a Python library. |
comment:50
I need to do a write up about this. I guess I exchanged a bigger patch for a smaller one and an extra file. The issue with your python module is that it is not a proper package. I don't have a tarball for the source apart from sage's own source and it is not versioned. So as a distro packager I am looking at this as extra work if I want to package it as a separate python module because I have to do the packaging and versioning myself. So right now I have a patch to look for sage.sage_conf in env.py, and I am putting sage_conf.py next to env.py. There may be something wrong with putting sage_cong.py.in in the source themselves. But replacing it by an half assed package is hardly ideal. |
comment:51
Replying to @kiwifb:
We can make ./bootstrap to generate a tarball of it in upstream/ just as it's done Will it help? |
comment:52
It'd possibly be an improvement if it is properly versioned. But it would still need to be pre-processed before it being usable. You are running away from the complexity by heaping a bit more :) I can adapt with most of the stuff that you throw at me. I have been doing that for about 12 years now. But I am fairly much in agreement with Erik that a different design should have been chosen altogether. In fact it's been years that I have been expecting sage to get a setup.cfg - at the very least for optional packages (the new design for coinor/gurobi/cplex rocks by the way). |
comment:53
Replying to @kiwifb:
Are you commenting on the right ticket? #29038 was merged, not this one. |
comment:54
You are right I should have commented on the other ticket. I just took the conversation on this ticket when I found it first in my inbox this morning. That being said I have been thinking of doing a comment for a week so I just took the opportunity before postponing it and never writing it. Of course the order I read things in my inbox in the morning is also a big influence in this case. But if I had waited to read all my inbox before thinking "I should put my comment there" I may not have written it at all :( |
comment:55
I recommend to read #21707. It gives the high-level overview. |
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 importsage.all
in the absence of the shell scriptsage-env
. (Getting a fully functionalsage.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:
With this ticket:
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
andMAXIMA
(to the location of themaxima
binary), but alsoSAGE_ROOT
could be added (for developer conveniences such as sage.misc.edit_module; see also #25486); and later packages'spkg-configure
might be settingMATHJAX_DIR
etc.In a follow-up ticket,
src/sage/env_config.py
would actually be generated bysrc/setup.py
, notconfigure
.Ticket #29038 provides an alternative implementation that uses an standalone installed Python module
sage_conf
, rather than writing intosrc/sage
Related:
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
The text was updated successfully, but these errors were encountered: