Skip to content

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

@paugier

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/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions