In case someone else stumbles on this, this was my fix
<https://github.com/edgarcosta/pyfib/commit/f30cd702f5b8610a284b1b1f425ef22b2a2a11fa>
:

from Cython.Build import cythonize as cython_cythonize

try:
    from sage.misc.package_dir import cython_namespace_package_support
    def cythonize(*args, **kwargs):
        with cython_namespace_package_support():
            return cython_cythonize(*args, **kwargs)
except ImportError:
    cythonize = cython_cythonize

On Sun, Oct 29, 2023 at 8:08 PM Matthias Koeppe <matthiaskoe...@gmail.com>
wrote:

> You'll need sage.misc.package_dir.cython_namespace_package_support
>
>
>
>
> On Sunday, October 29, 2023 at 5:00:08 PM UTC-7 Edgar Costa wrote:
>
>> Hello,
>>
>> Cythonizing a package, via setuptools, that uses a `from sage.foo cimport
>> bar` seems to no longer work with Sage 10.2.beta8
>>
>> Here is a minimal example:
>> sage -pip install git+https://github.com/edgarcosta/pyfib.git@main
>>
>> here is the error log:
>> https://gist.github.com/edgarcosta/a0a189839c9053c30a33f60435431957
>>
>> Note, that one can also try to install the package without the `from
>> sage.rings.integer cimport Integer`, via
>> sage -pip install git+https://github.com/edgarcosta/pyfib.git@nosage
>> and then everything works as expected.
>>
>> I believe this has something to do with  PEP-420 and the recent upgrade
>> to Cython3.0
>>
>> https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#namespace-packages
>>
>> Furthermore, by looking at commits like this one
>>
>> https://github.com/sagemath/sage/pull/36110/commits/cb78fd95b03678f821bc575c683feb74f860105c
>> it gives me the idea that there is something to do with relative imports,
>> but I am not sure.
>>
>> Any insight would be appreciated, as all my Cython pip installable
>> packages fail exactly the same way.
>>
>> Cheers,
>> Edgar
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/80033da2-a3dd-4aa9-b52d-f0272ab5c5cbn%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/80033da2-a3dd-4aa9-b52d-f0272ab5c5cbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CA%2BiQ7x7SBjOpY6b9LY67a1a_KwzuFzF82NDS%2Bq7hURp8T9mJMg%40mail.gmail.com.

Reply via email to