-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Skip backport packages for newer python #36776
Conversation
I ran |
Need to change install-requires.txt for these packages then to conditionalize on Python version. |
Hopefully that's the right syntax, I based it on https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#platform-specific-dependencies |
you need to check that you're not using Python from the system (currently needing this package). Just wrap everything in |
82c596c
to
d271eb0
Compare
The new version checks |
|
Also: nothing in sagelib uses either package, and afaiu python modules are pip-installed. Seems highly redundant to document dependencies of dependencies. It seems to me only dependencies of packages with custom install should be kept. E.g. typing_extensions is only a dependency of setuptools_scm, so it's not really a dependency of sagemath at all, and it shouldn't be listed in requirements of sagemath-standard, etc. BTW, there are tons of packages where BTW |
Clearer dependencies will be possible with #36740, please review |
Yes that's when the libraries were added, but newer Python versions provide new functions and, important for us, better support for PEP 420 namespace packages. |
Normal packages (with checksums.ini) do not have access to PyPI. So we are installing all dependencies; and when installed from source, also build dependencies. |
I'm not interested in |
OK why talk about spkg-* anything then? |
src/pyproject.toml.m4 and src/setup.cfg.m4 is all that will matter to you then. |
It's true that currently these backport packages are not used in sagelib. |
I just came by this PR since I made a comment in good faith. My mistake, sorry. I'll retract back to my corner of the world. |
You are right that |
Yes, I think that could be a nice simplification. |
Sure. What about importlib_resources, importlib_metadata, typing_extensions ? They don't seem to be required by sagemath-standard (eventually as a transitive dependency). Also: sphinx, not really necessary for running sage, afaict. Another thing is sage_conf: I do fine with a two-line |
As I said in #36776 (comment), these are there deliberately |
If you were to put that in a doctest, you force me to either patch it out, or stop shipping sagemath (which, for me, it would mean stop using it). I think we should move in the direction of removing these kind of tests, instead of adding them. Sage is completely usable even if you think that is a bug.
It's never that hard. The low level stuff is the more complicated (e.g. they seem to enjoy playing with integers lately) but it's mostly concentrated in a few packages that abstract the changes away. Other stuff usually has deprecation warnings and packages that are well maintained don't take too long to adjust. It's ok if you prefer to move a little bit slower; I never proposed that sagemath moves to python 3.12, only that requirements.txt stops claiming that it won't work with python 3.12, because it does work. Ultimately, I don't really care about that either; except I tried to pip install sage_conf to see how it works and I was forbidden to do it (and I don't think sage_conf is going to be affected by the recursion issue, is it?). |
my point is that major Python3 upgrades introduce incompatibilities. A distro that's serious about its users ought to keep an older version of Python around, just in case. |
@tornaria Given your report of this, I would support making this change. PR please? |
@tornaria I know. I made that work in #32759. But as you observed elsewhere, it provides the formatting of the docstrings in the interactive help. That's a standard functionality, so it's a dependency of sagemath-standard. |
Yeah that's exactly what I mean. You shouldn't have to run your own distro to be able to build sagelib. Sage should be able to detect GAP and find those databases on its own rather than requiring you to place them exactly where it wants them and/or hand-edit conf.py. |
# These packages are therefore not needed with >=python-3.11. Here | ||
# we test for a python minor version component greater than or equal | ||
# to 11, and mark this package as "not required" if we succeed. | ||
AC_MSG_CHECKING([for >=python-3.11]) |
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.
Why does the Python version need a separate check in spkg-configure.m4
?
Does the conditionalization in install-requires.txt
not do the job already? Checking whether importlib_metadata >=4.13; python_version<'3.11'
is available will be trivially true for Python >= 3.11
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.
Oh. I wrote that check before you pointed out that we needed to change install-requires.txt. It's probably redundant now but I have to get flint-3.x packaged before I can run ./configure
now.
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.
I had to change the quoting in the macro but it basically works, if you don't care that it says "will use the system foo" rather than "foo is not required" when it skips the package.
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.
I think that's fine
Some version specifiers in install-requires.txt will contain single quotes; for example, python_version<'3.11'. (This is according to the setuptools "Platform Specific Dependencies" documentation.) To support that, we double-quote the spec string rather than single quote it.
d271eb0
to
c192fb5
Compare
m4/sage_python_package_check.m4
Outdated
@@ -75,10 +75,13 @@ AC_DEFUN([SAGE_PYTHON_PACKAGE_CHECK], [ | |||
PYTHONUSERBASE="${HOME}/.sage/local" | |||
]) | |||
|
|||
dnl double-quote SAGE_PKG_VERSPEC because platform-specific | |||
dnl dependencies like python_version<'3.11' will have single | |||
dnl quotes in them. |
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.
Actually, you can use double quotes in install-requires.txt.
And in fact double quotes are better because then m4/sage_spkg_versions_toml.m4
will be generated correctly!
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.
(relevant for #36951)
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.
Ok, double quotes it is. I changed the package-check macro to normalize them (back to single quotes) so that both are supported, at least in that one macro.
For the moment, this is an easy fix for the ./bootstrap generation of sage_spkg_versions_toml.m4, which single-quotes the contents of install-requires.
Platform version constraints in install-requires can be either single- or double-quoted. To keep things simple, we'd like to assume in the macro that they are single-quoted, following the examples in the documentation. We now use sed to normalize them.
Documentation preview for this PR (built with commit 0b08052; changes) is ready! 🎉 |
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.
LGTM, thanks.
Three of our SPKGs are backports that provide python-3.11 features: * importlib_metadata * importlib_resources * typing_extensions As a result, they are not needed when sage's python is v3.11 or newer. We un-require them in `spkg-configure.m4` URL: sagemath#36776 Reported by: Michael Orlitzky Reviewer(s): Matthias Köppe, Michael Orlitzky
Three of our SPKGs are backports that provide python-3.11 features: * importlib_metadata * importlib_resources * typing_extensions As a result, they are not needed when sage's python is v3.11 or newer. We un-require them in `spkg-configure.m4` URL: sagemath#36776 Reported by: Michael Orlitzky Reviewer(s): Matthias Köppe, Michael Orlitzky
Three of our SPKGs are backports that provide python-3.11 features: * importlib_metadata * importlib_resources * typing_extensions As a result, they are not needed when sage's python is v3.11 or newer. We un-require them in `spkg-configure.m4` URL: sagemath#36776 Reported by: Michael Orlitzky Reviewer(s): Matthias Köppe, Michael Orlitzky
After sagemath#36129 and sagemath#36776 we are still left with a bunch of external (non- Sage) Python packages which need `spkg-configure.m4` and distros info. Here we add these. ### 📝 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: ... --> - sagemath#36129 - sagemath#36776 <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36777 Reported by: Dima Pasechnik Reviewer(s):
…kages <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> - sagemath#35203 added these packages as unconditional dependencies - prompted by a sporadic use of typing_extensions in the Sage library (see sagemath#34831) - motivated further by the demand to immediately drop support for Python 3.8 so that newer typing features can be used in the Sage library (sagemath#35404) - sagemath#36776 reduced the packages to conditional dependencies Here we improve the documentation in the section "Language standard" of the developer's guide so that it aligns with how the conditional dependencies are declared. Based on changes split out from sagemath#37399. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37654 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Matthias Köppe
…gemath#36776 <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As reported in https://groups.google.com/g/sage-devel/c/8ZsBcHGmn6s @culler ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37959 Reported by: Matthias Köppe Reviewer(s):
Three of our SPKGs are backports that provide python-3.11 features:
As a result, they are not needed when sage's python is v3.11 or newer. We un-require them in
spkg-configure.m4