-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Access database and other files through features, for simpler configuration #37024
Conversation
What's with this:
I can't reproduce. |
Very nice. I'll take a closer look later. |
src/sage/features/__init__.py
Outdated
Feature('null') | ||
sage: sh = StaticFile(name="shell", filename="sh", | ||
....: search_path="/dev:/bin:/usr") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one test failure here because I forgot to change this test after I removed the split at ":" feature for search_path
.
I'll fix it after current CI finishes with this:
....: search_path="/dev:/bin:/usr") | |
....: search_path=("/dev", "/bin", "/usr")) |
I think this is ready to go. Only failure is in codecov/patch, but for some of the new lines I have no way to test them in CI (need optional packages, etc). |
I moved |
Overall, looks good to me. The solution for replacing the I'll hold off with setting to positive review for a moment so that other downstream packagers can comment whether this meets their needs. Feel free to set to positive review if there's no reaction. |
I strongly believe that separate packages with static sagelib dependencies and discoverability via python is a better design, but this doesn't make anything worse at the moment. |
Can you please include my improvements from https://github.com/orlitzky/mols-handbook-data/commits/master/ since this ticket will be used as an excuse not to merge them? |
Sure, should I just place your This way we keep your documentation and testing. |
Yeah that's fine with me. A few doctests might need to be tweaked to use |
Done. Feel free to make a PR against my branch if you think anything else needs changing, or just make a follow-up PR on top of this. |
I think using separate packages is fine if there's an active upstream that cares about the package. What you are suggesting is that sagemath becomes the upstream for a package that (in principle) only sagemath will use and for which there is no technical advantage for splitting. Being upstream for a few packages is not working well for sagemath, and it doesn't scale. You make the package to start with, but are you willing to maintain it? Do you even have the bandwidth to maintain all of this? For instance, you created conway-polynomials and got it used in sagemath, but there are two open PRs (from before this was merged into sagemath) that didn't even get a "not interested" comment. |
SageMath is also upstream for it when you include it with sagelib. The technical advantage for the combinatorial designs is minor (for example, saving space in most peoples' git checkouts) but nonzero. For the other database packages, the advantages are greater: not having to define
I moved the repo under the sagemath organization so that I'm not a single point of failure, but if there's a group of people who get sagemath notifications by default, I'm not in it. You haven't gotten a response not because I'm ignoring them, but because I didn't know they were there. |
Yes but it's just a file out of 10k.
Not significant, moreover all the files
Sure: having a proper "python" package instead of an ad-hoc "spkg" package seems nicer, but it still has a cost, and an "ad-hoc" python package may not be enough benefit to offset the cost. At least updating a file in the main repo is something that we know how to do, but managing several packages and pypi is something we do badly. Examples: cypari2 (I think) needed to be updated but noone could do it in pypi; threejs-sage is a mess and there is an upstream but sage is too special to use that so fork it and then have a mishmash of versions between spkg / gh / pypi / upstream, moreover having a separate package (forked, under full sagemath control) is useless since the filepaths have an exact version so the package can't really be updated independent of sagemath. Since I'm ranting: we have sage_setup split off (why?) but we require exactly the same version, what is that good for? I have sage_setup 10.2 in my system and I can't use it to build 10.3.beta4, wtf, etc, etc.
I'm not blaming you, and the issue is not new nor specific to this package. I have other PRs in the same status (e.g. sagemath/cysignals#192). Another one is sagemath/cypari2#138, and before you say this is merged, look again because here it's not: https://pypi.org/project/cypari2/. |
Search path at sage.env.SAGE_DATA_PATH with a good default. Function `sage_data_path(data_name)` creates search path for a database named `data_name`.
This way databases can be found in several locations, reducing the need for sage_conf.
Rebased without changes on top of 10.3.beta5. |
Documentation preview for this PR (built with commit 2d3b596; changes) is ready! 🎉 |
…or simpler configuration This PR reworks the way sagemath access database files, and some other external files. The end result is that the runtime detection of databases as features matches exactly what will be used. Moreover, this leads to an easy implementation of search paths, meaning we don't need configuration as long as the files are in a few standard system locations. Notes on implementation: - First every user of these files access them via features, and never directly through `sage.env`, since the former is dynamic and the latter is static. - Then we add a variable `SAGE_DATA_PATH` which is a colon separated search path for databases. The default should work for sage-the-distro and most distros (think `/usr/share/sagemath:/usr/share` for a system install on `/usr`). - Now a database, say `cremona` is searched on `$p/cremona` for each `$p` in `SAGE_DATA_PATH`. - I also added `$DOT_SAGE/db` first in the search path, this makes it easy for a user to install a missing database (or update an old one). - Finally, as an example I did something similar to find `JmolData.jar` and `three.min.js`. The former is searched in `$SAGE_SHARE/sagemath/jmol` and `$SAGE_SHARE/jmol` and the latter also in `$SAGE_SHARE/jupyter/nbextensions/threejs-sage` which seems to make sense. Other files can be done later (e.g. mathjax). In principle anything that has a default value in `sage.env` or `sage_conf` should benefit from using a search path and removing the default value. With this PR, I can run stock sagemath without any `sage_conf.py`. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. ### ⌛ Dependencies URL: sagemath#37024 Reported by: Gonzalo Tornaría Reviewer(s): François Bissey, Gonzalo Tornaría, Matthias Köppe, Michael Orlitzky
…or simpler configuration This PR reworks the way sagemath access database files, and some other external files. The end result is that the runtime detection of databases as features matches exactly what will be used. Moreover, this leads to an easy implementation of search paths, meaning we don't need configuration as long as the files are in a few standard system locations. Notes on implementation: - First every user of these files access them via features, and never directly through `sage.env`, since the former is dynamic and the latter is static. - Then we add a variable `SAGE_DATA_PATH` which is a colon separated search path for databases. The default should work for sage-the-distro and most distros (think `/usr/share/sagemath:/usr/share` for a system install on `/usr`). - Now a database, say `cremona` is searched on `$p/cremona` for each `$p` in `SAGE_DATA_PATH`. - I also added `$DOT_SAGE/db` first in the search path, this makes it easy for a user to install a missing database (or update an old one). - Finally, as an example I did something similar to find `JmolData.jar` and `three.min.js`. The former is searched in `$SAGE_SHARE/sagemath/jmol` and `$SAGE_SHARE/jmol` and the latter also in `$SAGE_SHARE/jupyter/nbextensions/threejs-sage` which seems to make sense. Other files can be done later (e.g. mathjax). In principle anything that has a default value in `sage.env` or `sage_conf` should benefit from using a search path and removing the default value. With this PR, I can run stock sagemath without any `sage_conf.py`. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. ### ⌛ Dependencies URL: sagemath#37024 Reported by: Gonzalo Tornaría Reviewer(s): François Bissey, Gonzalo Tornaría, Matthias Köppe, Michael Orlitzky
…or simpler configuration This PR reworks the way sagemath access database files, and some other external files. The end result is that the runtime detection of databases as features matches exactly what will be used. Moreover, this leads to an easy implementation of search paths, meaning we don't need configuration as long as the files are in a few standard system locations. Notes on implementation: - First every user of these files access them via features, and never directly through `sage.env`, since the former is dynamic and the latter is static. - Then we add a variable `SAGE_DATA_PATH` which is a colon separated search path for databases. The default should work for sage-the-distro and most distros (think `/usr/share/sagemath:/usr/share` for a system install on `/usr`). - Now a database, say `cremona` is searched on `$p/cremona` for each `$p` in `SAGE_DATA_PATH`. - I also added `$DOT_SAGE/db` first in the search path, this makes it easy for a user to install a missing database (or update an old one). - Finally, as an example I did something similar to find `JmolData.jar` and `three.min.js`. The former is searched in `$SAGE_SHARE/sagemath/jmol` and `$SAGE_SHARE/jmol` and the latter also in `$SAGE_SHARE/jupyter/nbextensions/threejs-sage` which seems to make sense. Other files can be done later (e.g. mathjax). In principle anything that has a default value in `sage.env` or `sage_conf` should benefit from using a search path and removing the default value. With this PR, I can run stock sagemath without any `sage_conf.py`. ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have created tests covering the changes. ### ⌛ Dependencies URL: sagemath#37024 Reported by: Gonzalo Tornaría Reviewer(s): François Bissey, Gonzalo Tornaría, Matthias Köppe, Michael Orlitzky
As noted in sagemath#37024 and in sagemath#36489, `sage-conf` is actually not needed on a few systems now. For this reason, we make the installation of it optional (as there are no optional install requires as far as I know, this means we remove it from `pyproject.toml` and `setup.cfg`). We also remove it from "install all dependencies via conda" as its not needed there.
…ion after sagemath#37024 <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> `sage.features` is shipped by **sagemath-environment**, but the version file that the Feature introduced in sagemath#37024 uses is shipped by **sagemath-repl**. This breaks doctesting in a modularized environment. As seen in ipython/ipython#14317 (https://github.com/ipytho n/ipython/actions/runs/7731330166/job/21078723213?pr=14317#step:9:136) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#37178 Reported by: Matthias Köppe Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe
…ion after sagemath#37024 <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> `sage.features` is shipped by **sagemath-environment**, but the version file that the Feature introduced in sagemath#37024 uses is shipped by **sagemath-repl**. This breaks doctesting in a modularized environment. As seen in ipython/ipython#14317 (https://github.com/ipytho n/ipython/actions/runs/7731330166/job/21078723213?pr=14317#step:9:136) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#37178 Reported by: Matthias Köppe Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe
…ion after sagemath#37024 <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> `sage.features` is shipped by **sagemath-environment**, but the version file that the Feature introduced in sagemath#37024 uses is shipped by **sagemath-repl**. This breaks doctesting in a modularized environment. As seen in ipython/ipython#14317 (https://github.com/ipytho n/ipython/actions/runs/7731330166/job/21078723213?pr=14317#step:9:136) <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#37178 Reported by: Matthias Köppe Reviewer(s): Gonzalo Tornaría, Kwankyu Lee, Matthias Köppe
As noted in sagemath#37024 and in sagemath#36489, `sage-conf` is actually not needed on a few systems now. For this reason, we make the installation of it optional (as there are no optional install requires as far as I know, this means we remove it from `pyproject.toml` and `setup.cfg`). We also remove it from "install all dependencies via conda" as its not needed there.
As noted in sagemath#37024 and in sagemath#36489, `sage-conf` is actually not needed on a few systems now. For this reason, we make the installation of it optional (as there are no optional install requires as far as I know, this means we remove it from `pyproject.toml` and `setup.cfg`). We also remove it from "install all dependencies via conda" as its not needed there.
This PR reworks the way sagemath access database files, and some other external files. The end result is that the runtime detection of databases as features matches exactly what will be used. Moreover, this leads to an easy implementation of search paths, meaning we don't need configuration as long as the files are in a few standard system locations.
Notes on implementation:
sage.env
, since the former is dynamic and the latter is static.SAGE_DATA_PATH
which is a colon separated search path for databases. The default should work for sage-the-distro and most distros (think/usr/share/sagemath:/usr/share
for a system install on/usr
).cremona
is searched on$p/cremona
for each$p
inSAGE_DATA_PATH
.$DOT_SAGE/db
first in the search path, this makes it easy for a user to install a missing database (or update an old one).JmolData.jar
andthree.min.js
. The former is searched in$SAGE_SHARE/sagemath/jmol
and$SAGE_SHARE/jmol
and the latter also in$SAGE_SHARE/jupyter/nbextensions/threejs-sage
which seems to make sense.Other files can be done later (e.g. mathjax). In principle anything that has a default value in
sage.env
orsage_conf
should benefit from using a search path and removing the default value.With this PR, I can run stock sagemath without any
sage_conf.py
.📝 Checklist
⌛ Dependencies