Skip to content

Explain the difference between C API and ABI - #2145

Open
harshitethic wants to merge 1 commit into
pypa:mainfrom
harshitethic:docs-api-abi-47
Open

harshitethic wants to merge 1 commit into
pypa:mainfrom
harshitethic:docs-api-abi-47

Conversation

@harshitethic

@harshitethic harshitethic commented Sep 29, 2026 •

Copy link
Copy Markdown

Addresses #47.

Summary

  • explain API as the source-level contract and ABI as the binary-level contract
  • connect ABI compatibility to CPython minor versions and platforms
  • point readers to the Limited API / Stable ABI and abi3 wheels

Validation

  • documentation-only change
  • isolated one-file diff against the current guide

📚 Documentation preview 📚: https://python-packaging-user-guide--2145.org.readthedocs.build/en/2145/

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! The updated content is good, but it highlights the fact that the current paragraph is really in the wrong place (as it applies to all extension modules, not just those written to wrap external libraries). We should move it up to a better location rather than leaving it where it is.

CPython C API (Application Programming Interface) is allowing Python users
to tap into that functionality. However, wrapping modules by hand is quite
tedious, so a number of other alternative approaches should be considered.
The C API (Application Programming Interface) is the source-level

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This background info isn't specific to wrapper modules, so it should be moved up under the "An overview of binary extensions" section.

I would suggest a new 'How binary extension modules work' subheading after the current "Disadvantages" heading, and tweaking the wording to refer to "maintaining binary extension modules" in general rather than "wrapping modules" specifically.

details such as exported symbols, calling conventions, and data layout.

CPython exposes a rich C API, but extensions built against the full API are
normally tied to the CPython minor version and platform they were compiled

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor is confusing, so Python talks about feature releases and bugfix releases, or uses examples like 3.X.

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

Successfully merging this pull request may close these issues.

3 participants