sagemath/sage

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

New commits:

7e72b2abuild/pkgs/cython/patches/4918.patch: New

Commit: 7e72b2a

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/4918

Branch pushed to git repo; I updated commit sha1. New commits:

176531abuild/pkgs/cython/package-version.txt: Add patchlevel

Changed commit from 7e72b2a to 176531a

comment:5

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.

comment:6

Thanks for testing!

Branch pushed to git repo; I updated commit sha1. New commits:

a2f798024237: upgrade; Cython 0.29.32
48a9ba2Merge #34237

Changed commit from 176531a to 48a9ba2

Dependencies: #34237

comment:11

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

comment:12

Thanks!

comment:14

@jhpalmieri - the p_group_cohomology issue can be fixed by adding a symlink.
See this message on sage-devel.

comment:15

Thank you, I added that link to the discussion at #30787.

comment:16

For my information, is this needed to build sage now? Or will it be needed once we split sagelib for real?

comment:17

It's not needed for building sagelib, but it is needed for building other packages as described in the ticket description

comment:18

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.

comment:19

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.

comment:20

Thank you for answering my pesky questions.