-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
sagemath: use cython 3 #45887
sagemath: use cython 3 #45887
Conversation
df0d218
to
6ac18ef
Compare
What is the benefit of building with Cython 3 in advance of an official Sage release that includes these changes? |
Mainly that I can install cython 3 together with sagemath, which is quite useful for me to test beta releases of sagemath and proposed PRs in advance. But that's just me and I can build this locally myself. Running this PR through CI is a way to make sure everything works fine for us, which is good feedback to give upstream before they do the next release, in particular sagemath/sage#36110 is still not given positive review and the fact that we have tested it onthree different architectures is useful (unfortunately some deps are nocross). I noticed that you made it so cython 3 can replace cython 0.29, but some I'm now runing tests under this scenario, and there are a couple of failures (mainly because a mismatch in the type of cython functions between version 0.29 and 3.x). |
You can Both Cython packages replace each other because that is needed to allow a clean update path to the current |
All of that is pointless, since sagemath built with cython 0.29 is broken with cython 3.0. |
6ac18ef
to
ba0c763
Compare
[I thought I already posted a response, but it seems lost to the ether.] I understand that Sage built with Cython 0.29 is broken with Cython 3.0, but my point was that you can easily swap between installed Cython versions to test a locally built Sage with these patches. The general policy for patches is that they should be limited to critical fixes in advance of an official release or correct an incompatibility introduced by our own packaging choices (e.g., to support special aspects of our cross building). New features, even when merged upstream, should wait until an official release introduces them. This is particularly true here, where the patches to add support are more than 9k lines long. |
After an out-of-band discussion about this PR, I am less concerned about carrying these patches. That said, is there any argument in favor of just bumping |
After thinking it thoroughly I don't think there is a rush to have sagemath with cython 3 merged (even if I believe the patches to be pretty safe). Since nothing in the repo depends on I'm happy to either close or move to draft this PR. In any case this will stay available for whoever needs to run sagemath on cython3.
We've tried to stick with releases rather than betas. The problem with betas is that sometimes there are features that are "half-merged" so I wouldn't be confident. I much prefer cherry-picking PRs that have been already merged and beta-released. I also try to only use patches I personally review (the 9k lines patch I actually read line by line and positive review myself). OTOH, sometimes I consider having some package "sagemath-next" which previews the future sagemath (carrying the latest beta / rc) in a way that it can coexist with "sagemath". |
In that case, we can mark this draft and move it to 10.2 when ready. In the meantime, if a compelling need to jump to Cython 3 arises sooner, we will have this ready to go in its current state. |
ba0c763
to
74c6a69
Compare
Updated for python 3.12. Note: in principle we won't be merging this. When sagemath 10.2 is released, it will move to cython 3. But the current betas of sagemath 10.2 need cython 3 to build so it's easier if the system sagemath also runs with cython 3. |
cython/cython#5690 cython/cython#5725 Both are merged in cython 3.0.3, however that release breaks scipy.
74c6a69
to
d26636f
Compare
It turns out #46553 is needed for sagemath to pass check with cython 3. |
I won't keep up this PR anymore. If you need sagemath with cython 3, use #46832. |
Testing the changes
Since sagemath/sage#36109 was merged upstream, it's now almost trivial to build sagemath with cython 3. This PR is pretty straightforward to understand:
python3-pplpy
using cython 3. Nothing fancy here and this commit was already tested and only dropped since it turned out it had to be built with the same version of cython as sagemath itself.Description of added patches:
36109-00pre.patch
: this is hand picked trivial patch that allows us to apply Prepare for updating Cython to 3.0.0 sagemath/sage#36109 cleanly on 10.1 (since that PR is based on 10.1.beta0). All changes are comments!36109-prepare_for_cython_3.0.patch
: this is long, taken verbatim from https://github.com/sagemath/sage/pull/36109.diff, and is already merged.build-cython3.patch
: this is 2 lines changed plus 4 legacy build options added to cython setup.fix-doctest-cython3.patch
: this is a few fixes in doctests to accomodate minor changes in cython output (__repr__
for cython classes, functions, and generators).CC: @ahesford