pypa / packaging.python.org

Python Packaging User Guide
http://packaging.python.org
1.43k stars 918 forks source link

API/ABI difference needs to be explained #47

Open techtonik opened 10 years ago

techtonik commented 10 years ago

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.

ncoghlan commented 10 years ago

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.

techtonik commented 10 years ago

Looks like a good task for OpenHatch project.

reuven commented 6 years ago

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.

theacodes commented 6 years ago

@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.

ncoghlan commented 6 years ago

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)
gauravsingh-code commented 1 year ago

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 .