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

What to do about PyCXX? #3498

Closed
mdboom opened this issue Sep 10, 2014 · 10 comments
Closed

What to do about PyCXX? #3498

mdboom opened this issue Sep 10, 2014 · 10 comments
Assignees

Comments

@mdboom
Copy link
Member

mdboom commented Sep 10, 2014

The Sourceforge project seems to be gone. Is it abandoned? If so, what do we do about it?

@tacaswell tacaswell added this to the unassigned milestone Sep 10, 2014
@jkseppan
Copy link
Member

What are the alternatives? Cython, Boost.Python, Pyplusplus, Swig?

@mdboom
Copy link
Member Author

mdboom commented Sep 10, 2014

I'm not a huge fan of any of the alternatives, except possibly the raw Python/C API.

A viable alternative is also to keep using our own fork of PyCXX, but make a separate release so that distro packagers don't complain.

@efiring
Copy link
Member

efiring commented Sep 10, 2014

In my view, the only potentially acceptable alternatives to continuing with our own PyCXX are Cython and raw. Cython works well for C, and is solidly established in our ecosystem. I know work has been done to improve C++ support, but I don't know how far it has gotten. If it is adequate for our C++ interfacing needs, then it would be my preference. Longer term, I don't like the idea of mpl needing to support a full-blown project like PyCXX, but it might be the least-bad option.
I suspect @ianthomas23 would vote for phasing it out in favor of raw APIs, correct?

@ianthomas23
Copy link
Member

@efiring: Yes, I would vote for phasing out PyCXX. In the interests of seeing how hard it would be to support PyCXX I did attempt to add numpy arrays to it. Although I made some progress, I concluded that the code was too esoteric for occasional maintenance, i.e. I would not choose to support it.

As for replacements, I agree with the raw Python/C API and/or Cython as we concluded in the discussion on matplotlib-devel some time ago. Personally I would opt for the raw Python/C API as I am familiar and comfortable with it. I don't see the transition from PyCXX to raw Python/C API as being any big deal, as PyCXX extensions already have to use the raw Python/C API for numpy arrays anyway. Incidentally, I initially wrote my first mpl extension using the raw Python/C API but was persuaded at the time to convert it to PyCXX as that was the preferred approach!

If we want to standardise on Cython instead, I would be happy with that but as I have no experience of it I would need someone to convert one of our existing extensions from PyCXX to Cython to show me what to do, and then I would follow that.

@pelson
Copy link
Member

pelson commented Sep 23, 2014

I know work has been done to improve C++ support, but I don't know how far it has gotten.

From my limited experience, it seems the C++ support is very good at this point. FWIW Cartopy is making use of Cython to wrap a C library (GEOS) and some C++ code in the same module https://github.com/SciTools/cartopy/blob/master/lib/cartopy/trace.pyx.

@matthew-brett
Copy link
Contributor

Cython is also being actively developed and numpy, scipy are using Cython,
so the Cython route will probably give you a better chance of help and new
developers.​

@breedlun
Copy link
Contributor

breedlun commented Oct 9, 2014

Could Numba work here? (http://numba.pydata.org)

@efiring
Copy link
Member

efiring commented Oct 9, 2014

@stretch97: No, numba is for speeding up loops in Python that can't be vectorized efficiently with numpy. We are using CXX mainly to wrap external libraries, together with some internal C++ code. It's a completely different operation.

@mdboom mdboom self-assigned this Oct 9, 2014
@mdboom
Copy link
Member Author

mdboom commented Oct 20, 2014

Just to update the original issue. master is now CXX-free with the exception of _tri.cpp, which should get done, given time.

@mdboom
Copy link
Member Author

mdboom commented Nov 18, 2014

Closing. CXX is gone.

@mdboom mdboom closed this as completed Nov 18, 2014
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

8 participants