packaging.python.org icon indicating copy to clipboard operation
packaging.python.org copied to clipboard

API/ABI difference needs to be explained

Open techtonik opened this issue 11 years ago • 6 comments

I wanted to add there links to extensions.rst page:

There were links here, but @theacodes removed them because they linked to NSFW spam

But could not find a good place to inject this. I am not sure that I completely get the difference between Public API and Stable API from a perspective of extension developer, and also there is no explanation what ABI is about and what is its practical purpose.

techtonik avatar Apr 04 '14 11:04 techtonik

Agreed - there's a placeholder in the binary extensions page, but I think we need to recognise that for a lot of Pythonistas, that page is going to be their first introduction to the idea of shipping compiled code at all.

It's also possible those details may belong in the embedding & extending section of the main CPython docs, or perhaps a new "HOWTO" guide.

ncoghlan avatar Apr 04 '14 22:04 ncoghlan

Looks like a good task for OpenHatch project.

techtonik avatar Apr 05 '14 06:04 techtonik

I was interested in working on this, but (a) the URLs referenced in @techtonik's first comment now point to something ... ahem, a bit unrelated to Python. And (b) there's no longer an "extensions.rst" file in the source. Is this issue still relevant? Do we really mean the "packaging-binary-extensions.rst" file? And if so, there is a mention of API vs. ABI, but I'm willing to admit/agree that it could use some additional explanation.

reuven avatar May 14 '18 18:05 reuven

@reuven oof, I removed those. extensions.rst has indeed been renamed to packaging-binary-extensions.rst. I definitely think we could expand more on the API/ABI thing, perhaps by writing a new specification.

theacodes avatar May 14 '18 18:05 theacodes

https://docs.python.org/3/c-api/stable.html and https://docs.python.org/3/c-api/apiabiversion.html#apiabiversion are the relevant CPython C API docs, but I think the packaging user guide needs something a bit more fundamental:

  1. Extension modules typically need to be rebuilt for each new Python version and each new Python interpreter
  2. This is indicated by compatibility tags in the created wheel archives (as per https://packaging.python.org/specifications/platform-compatibility-tags/ ), as well as in the naming of the extension modules themselves (I'm not sure we actually document that naming scheme anywhere in the CPython docs)
  3. For Python 3.2+, extension modules can be shared across interpreter versions by targeting the stable ABI and using a compatibility shim that gets rebuilt for each new version to handle the required operations that the stable ABI doesn't support (i.e. the way pysip works)

ncoghlan avatar May 14 '18 23:05 ncoghlan

Hello , I am know some basic data structure and java and c++ language at intermediate level . and currently learning python can anyone suggest me how to contribute to open source ?

Thanks in advance .

gauravsingh-code avatar Aug 17 '23 03:08 gauravsingh-code