Skip to content
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

Explore using Cython's Pure Python Mode #141

Open
jakirkham opened this issue Jan 24, 2025 · 1 comment
Open

Explore using Cython's Pure Python Mode #141

jakirkham opened this issue Jan 24, 2025 · 1 comment

Comments

@jakirkham
Copy link
Member

Cython has a Pure Python Mode. In some form, this has been around for a while. Starting in Cython 3 they have started to really advertise it. The docs include pure Python examples (and show them by default) so users now need to select the Cython examples

Think this is worth exploring as this could be helpful in a few ways:

  1. More developers know Python than Cython
  2. Tooling designed for Python can run on Pure Python Mode Cython files
  3. Having pure Python code reduces friction when trying new things

Now it is hard to say whether Pure Python Mode has enough for RAPIDS to use. Also we won't really know if it works for RAPIDS without trying it. So think the first step will involve picking code from a small, well-scoped project and see how changing it goes

Lastly as the goal would be to have pure Python code in the end. We should try to do as much as possible in pure Python. Only falling back to things like .pxd files as a last resort

As we explore, we are going to learn things. So part of the process will involve raising issues and discussing with upstream developers about our experiences and suggestions we may have

@jakirkham jakirkham changed the title Explore using Cython's pure Python mode Explore using Cython's Pure Python Mode Jan 24, 2025
@vyasr
Copy link
Contributor

vyasr commented Jan 24, 2025

I investigated this when I switched RAPIDS over to Cython 3 (which is the changelog that you linked). See rapidsai/cudf#15135. tl;dr pure Python mode has come a long way and is a strong focus for the Cython developers, and I think this is possible for pure Cython code, but I do not think it will be possible at any point in the foreseeable future to rewrite Cython bindings to C++ using pure Python mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants