Backport PEP420 namespace package support from Cython 3
Closed this issue · 22 comments
After #33011, downstream packages that use Cython and cimport Sage modules need to activate PEP 420 namespace package support in Cython using with cython_namespace_package_support (as is done in https://github.com/sagemath/sage-prod/blob/develop/src/setup.py#L106 for sagelib).
This feature is standard in the upcoming Cython 3 (#29863). Until downstream packages are updated, we can patch our Cython.
Upstream backport PR:
Depends on #34237
CC: @culler @tscrim @videlec @jhpalmieri
Component: packages: standard
Author: Matthias Koeppe
Branch/Commit: 48a9ba2
Reviewer: Marc Culler, John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/34221
Description changed:
---
+++
@@ -1,6 +1,6 @@
After #33011, downstream packages that use Cython and `cimport` Sage modules need to activate PEP 420 namespace package support in Cython using `with cython_namespace_package_support` (as is done in https://github.com/sagemath/sage-prod/blob/develop/src/setup.py#L106 for sagelib).
-This feature is standard in the upcoming Cython 3. Until downstream packages are updated, we can patch our Cython.
+This feature is standard in the upcoming Cython 3 (#29863). Until downstream packages are updated, we can patch our Cython.
Upstream backport PR:
- https://github.com/cython/cython/pull/4918Branch pushed to git repo; I updated commit sha1. New commits:
176531a | build/pkgs/cython/package-version.txt: Add patchlevel |
This solved all of the problems that I ran into with the p_group_cohomology and sage_numerical_backends_coin packages. The problems were caused by cython not finding the .pxd files that were needed for cimport statements. With this patch the cimports worked and I got a successful build of 9.7.beta6 on an arm64 mac with a minimal environment.
Thanks for testing!
This works for me and also fixes the problems with sage_numerical_backends_coin. p_group_cohomology still fails for me ("ld: library not found for -lmodres"), for what that's worth.
Reviewer: Marc Culler, John Palmieri
Thanks!
@jhpalmieri - the p_group_cohomology issue can be fixed by adding a symlink.
See this message on sage-devel.
Thank you, I added that link to the discussion at #30787.
For my information, is this needed to build sage now? Or will it be needed once we split sagelib for real?
It's not needed for building sagelib, but it is needed for building other packages as described in the ticket description
For downstream packages, yes. But I am assuming that once we split sagelib, the modules may need it too - but that's in the future.
The modularized packages such as sagemath-objects don't need it because they use with cython_namespace_package_support just like the monolithic sagelib does.
Thank you for answering my pesky questions.
Changed branch from u/mkoeppe/backport_pep420_namespace_package_support_from_cython_3 to 48a9ba2