Skip to content

Limited api / stable abi: simple command line option? #793

Closed as duplicate

Description

@paugier

I'd like for some packages to be able to build them in two ways:

  • targeting the version-specific ABI
  • targeting a specific version of the stable ABI (for example cp312-abi3) using the limited API

The documentation on what can currently be done with meson-python is here: https://mesonbuild.com/meson-python/reference/pyproject-settings.html#cmdoption-arg-tool.meson-python.limited-api

I see that it is currently quite inconvenient to do that.

One first needs to add

[tool.meson-python]
limited-api = true

but then, to build standard wheels, one needs to use

python -m build -Csetup-args="-Dpython.allow_limited_api=false"

And potentially add a project option to specify the limited_api version targeted so that one can run:

python -m build -Csetup-args=-Dlimited-api=3.12"

It seems to me that it would be nicer to have a specific meson-python option so that one can just run things like:

# to produce `cp312-abi3` wheels
python -m build -Climited-api=3.12
# to produce standard wheels
python -m build

Note that it seems that the limited API/stable ABI could become more important with 3.15 to build wheels compatible with free-threading and GIL-enabled builds of CPython (see https://peps.python.org/pep-0803/).

Activity

  1. rgommers commented on Oct 19, 2025

    @rgommers
    Contributor

    Thanks for the suggested improvement @paugier. It looks to me like you are largely correct - it's hard to use right now. I just noticed that there is more extensive discussion on this in gh-787. I think that covers everything in this issue. Could you please read through that and confirm that, and if not comment there? I'd like to close this as a duplicate and continue on that issue.

  2. rgommers commented on Oct 19, 2025

    @rgommers
    Contributor

    Note that that discussion does contain a workaround right now that may be helpful for you (the default_options: ['python.allow_limited_api=false'], part).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions