Skip to content

gh-104612: Document linking embedders for several Python versions - #162498

Merged
itamaro merged 5 commits into
python:mainfrom
itamaro:embedder-stable-abi-docs
Nov 27, 2026
Merged

itamaro merged 5 commits into
python:mainfrom
itamaro:embedder-stable-abi-docs

Conversation

@itamaro

@itamaro itamaro commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Add a section to the embedding guide that explains, for Linux, that linking with pythonX.Y-config --ldflags --embed ties an application to one minor version even when it only uses the Limited API, and how a single binary can instead load libpython3.so at run time. Mention renaming the dependency with patchelf as a packaging workaround, and list the limitations of both approaches.

Related discussion: https://discuss.python.org/t/on-embedders-and-stable-abi/110197

Add a section to the embedding guide that explains, for Linux, that
linking with `pythonX.Y-config --ldflags --embed` ties an application
to one minor version even when it only uses the Limited API, and how
a single binary can instead load `libpython3.so` at run time.
Mention renaming the dependency with `patchelf` as a packaging
workaround, and list the limitations of both approaches.

Related discussion: https://discuss.python.org/t/on-embedders-and-stable-abi/110197
@read-the-docs-community

read-the-docs-community Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

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

Great! Well written, easy to follow, it's the kind of addition I've been meaning to make for Windows for years now 😄

Left a few comments to help the flow and clarity, but don't rely on me for strict correctness. I've done all of these things before, but I didn't reference my earlier work to check, and I don't do them often enough on Linux to remember the details.

Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved

@ncoghlan ncoghlan left a comment

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.

LGTM! At a detailed level, I didn't have anything to add to @zooba's comments.

Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Comment thread Doc/extending/embedding.rst Resolved
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@itamaro
itamaro enabled auto-merge (squash) November 27, 2026 18:12
@itamaro
itamaro merged commit cb9d78f into python:main Nov 27, 2026
31 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Nov 27, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @itamaro for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @itamaro, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker cb9d78f2b75bf2185c139c8fbd3d3c0bc03f693e 3.14

@bedevere-app

bedevere-app Bot commented Nov 27, 2026

Copy link
Copy Markdown

GH-162760 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 27, 2026
@bedevere-app

bedevere-app Bot commented Nov 27, 2026

Copy link
Copy Markdown

GH-162761 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 27, 2026
itamaro added a commit that referenced this pull request Nov 27, 2026
…ons (GH-162498) (#162760)

gh-104612: Document linking embedders for several Python versions (GH-162498)

Add a section to the embedding guide that explains, for Linux, that linking with `pythonX.Y-config --ldflags --embed` ties an application to one minor version even when it only uses the Limited API, and how a single binary can instead load `libpython3.so` at run time. Mention renaming the dependency with `patchelf` as a packaging workaround, and list the limitations of both approaches.

Related discussion: https://discuss.python.org/t/on-embedders-and-stable-abi/110197
(cherry picked from commit cb9d78f)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
itamaro added a commit that referenced this pull request Nov 27, 2026
…ons (GH-162498) (#162761)

Add a section to the embedding guide that explains, for Linux, that linking with `pythonX.Y-config --ldflags --embed` ties an application to one minor version even when it only uses the Limited API, and how a single binary can instead load `libpython3.so` at run time. Mention renaming the dependency with `patchelf` as a packaging workaround, and list the limitations of both approaches.

Related discussion: https://discuss.python.org/t/on-embedders-and-stable-abi/110197

(cherry picked from commit cb9d78f)

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants