python-poetry/poetry

Creating pure Python wheels when using build scripts

Closed this issue · 4 comments

tueda commented
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Is there any way to create pure Python wheels (or universal wheels) when using build scripts?

I know that build scripts are still undocumented (#2740), but if I use pyproject.toml like

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.build]
generate-setup-file = false
script = "build.py"

then poetry build creates a platform wheel like hello-0.1.0-cp39-cp39-manylinux2014_x86_64.whl, which makes sense when building C-extensions.

But, when one wants to use build.py to generate some platform-independent resource files from the source (corresponding to setup.py build_py), platform wheels are not needed and pure Python wheels like hello-0.1.0-py3-none-any.whl may suffice.

It would be great if one could select pure Python wheels (and possibly also universal wheels) by configuring in pyproject.toml, for example,

[tool.poetry.build]
pure-python-wheel = true

I think there are already tickets on the topic of the platform tags of the wheel. Maybe you can find some valuable info in those.

tueda commented

Thank you for the comment. Indeed, it seems that I should have searched "platform tags" more thoroughly in the Issues. I found

The former already has a comment about the fact that poetry assumes platform wheels when build.py is used, pure Python wheels otherwise. I would close this as a duplicate.

FWIW, I think this is still a good idea as a stop gap until there is more full featured support build scripts. Having such an option would make it easier to build with the build script when using --format sdist and not when using --format wheel and avoid building wheels with arbitrary tags, but still have say Cython support when building an sdist.

Currently, the only way to do this is to manually exit the pyproject.toml file, remove the build line and rebuild.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.