New-C-API-for-Python icon indicating copy to clipboard operation
New-C-API-for-Python copied to clipboard

Add section listing alternative approaches

Open ericsnowcurrently opened this issue 3 years ago • 7 comments

There have been a number of informative discussions over the years (especially the last few years) about the future of the C-API. It would be worth taking advantage those discussions.

We can start by leaving links to those discussions here. Any of them that might warrant a deeper discussion could also get separate issues. (There's already some discussion about HPy.)

ericsnowcurrently avatar Aug 22 '22 17:08 ericsnowcurrently

I'll start. @zooba wrote down what I think are some important design principles:

https://mail.python.org/archives/list/[email protected]/thread/B2VDVLABM4RQ4ATEJXFZYWEGTBZPUBKW/

I've opened #7 for a deeper discussion.

ericsnowcurrently avatar Aug 22 '22 17:08 ericsnowcurrently

Here is the high-level HPy API manifesto and the slightly longer explanation of each item:

  • https://github.com/hpyproject/hpy/wiki/c-api-next-level-manifesto
  • https://github.com/hpyproject/hpy/wiki/c-api-next-level-changes

And the HPy implementation https://github.com/hpyproject/hpy/ as prior art.

HPy can already run kiwisolver, matplotlib, and enough of numpy to run a simple Game of Life. The links are to the respective ports.

hodgestar avatar Aug 25 '22 13:08 hodgestar

@vstinner has also made detailed proposals in the past and written extensively about it:

  • (2019) https://pythoncapi.readthedocs.io/
  • (2019) https://mail.python.org/archives/list/[email protected]/thread/RNI3UUI6XUPQQNECZT2DPZFMYIJ42KZ2/
  • (2019) https://mail.python.org/archives/list/[email protected]/thread/HS7WDUYFTT2MCAHQQM55UHPJLAVNYCWX/
  • (2018) https://mail.python.org/archives/list/[email protected]/thread/ENRZNKIFVKK5JUELQRZKGW4WL6FYCBZ3/
  • (2018) https://mail.python.org/archives/list/[email protected]/thread/IUFDUHKM2M3HHXBJWVOA2ZJUW2AEMMQI/
  • (2018) https://mail.python.org/archives/list/[email protected]/thread/STTM62RG57IZ2EYDTJ7SVW32S45I4FRO/
  • (2017) https://vstinner.github.io/new-python-c-api.html
  • https://vstinner.github.io/tag/c-api.html (other blog posts from Victor)

(Victor's personal Python notes at https://pythondev.readthedocs.io/ probably also have some related material.)

ericsnowcurrently avatar Aug 25 '22 15:08 ericsnowcurrently

Here's a discussion I started about having an official cython-like tool:

https://mail.python.org/archives/list/[email protected]/thread/NSREULQDHSJ6SZTOY5YVSNX4U4AYJOI6/

ericsnowcurrently avatar Aug 25 '22 15:08 ericsnowcurrently

A discussion started by @hodgestar about replacing the C-API with CFFI:

https://mail.python.org/archives/list/[email protected]/thread/ZV3IQWW7XL6MHZAJARHW62WNZDCX3A4M/

ericsnowcurrently avatar Aug 25 '22 15:08 ericsnowcurrently

@vstinner also publishes a backward-compatibility shim header that relates here:

https://pythoncapi-compat.readthedocs.io/

ericsnowcurrently avatar Aug 25 '22 15:08 ericsnowcurrently