Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document setting limited-api via build option better #624

Open
lpsinger opened this issue May 1, 2024 · 5 comments
Open

Document setting limited-api via build option better #624

lpsinger opened this issue May 1, 2024 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@lpsinger
Copy link
Contributor

lpsinger commented May 1, 2024

The limited-api option can only be set through pyproject.toml, not through the build config settings that you can provide on the command line to pip or python -m build.

Would you please consider supporting limited-api as a build config setting? I am using cibuildwheel to build a package that uses the limited API, but my build fails when it tries to install the build package and run my tests under pypy with the following error:

  ERROR: hpx-0.0.1-pp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl is not a supported wheel on this platform.

I would like to be able to customize the build so that it sets limited-api to false for PyPy, but I can't do this because limited-api is not a build config setting. Here's what I would like to do:

[tool.cibuildwheel]
config-settings.limited-api = true

# PyPy does not support the Python limited API.
[[tool.cibuildwheel.overrides]]
select = "pp*"
config-settings.limited-api = false
@eli-schwartz
Copy link
Member

build config settings, as in the kind that are compatible with pip install --config-settings="....", take the form:

--config-settings=setup-args="-Dpython.allow_limited_api=true"

as documented by https://mesonbuild.com/Builtin-options.html#module-options

@rgommers
Copy link
Contributor

rgommers commented May 1, 2024

Yes, we should be handling python.allow_limited_api:

value = next((option['value'] for option in options if option['name'] == 'python.allow_limited_api'), None)

And we just added a more descriptive error a few lines below that (not in the 0.16.0 release yet), but only for free-threaded CPython and not PyPy.

Guess we should improve the error message and the docs a bit more.

@lpsinger
Copy link
Contributor Author

lpsinger commented May 2, 2024

Yes, this worked, although somehow I found it hard to find this in the documentation.

@rgommers rgommers added the documentation Improvements or additions to documentation label May 2, 2024
@rgommers rgommers changed the title Support setting limited-api via build config settings Document setting limited-api via build option better May 2, 2024
@rgommers
Copy link
Contributor

rgommers commented May 2, 2024

Great, thanks for confirming. Changed the issue title to reflect that we need to improve the docs here.

@trim21
Copy link

trim21 commented Nov 27, 2024

What's the best way to do this currently?

Enable limited-api pyproject.toml and disable it with --config-settings=setup-args="-Dpython.allow_limited_api=false"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants