pypa/build

FR: build-backend support for `poetry` within `pyproject.toml`

adam-grant-hendry opened this issue · 4 comments

Related to poetry/#2740 , considering PEP 632, is it possible to use build as a backend with poetry to build platform-specific wheels and compile C-extensions?

NOTE: This might not be applicable since build is technically listed as a front-end but I thought I'd ask since the distutils SetuptoolsDeprecationWarning recommends trying pypa/build instead

distutils and setuptools are historically both a backend and frontend, and the deprecation suggesting build is only for the frontend part, since setuptools (absorbing distutils) only wants to be a backend moving forward, while build is only implements frontend functionalities.

So no, this does not make sense.

@uranusjr Quite alright. I was afraid this might be the case. Thank you for the clarification. I’ll go ahead and close this issue for now then.

Hi @adam-grant-hendry, the setuptools.build_meta module implements the build APIs specified by both PEP 517 and PEP 660, so if poetry wants to delegate anything to setuptools, that is something you can take into consideration for the implementation.

Hi @adam-grant-hendry, the setuptools.build_meta module implements the build APIs specified by both PEP 517 and PEP 660

Yes, I've already been doing that for some time now:

# pyproject.toml
...

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

[build-system]
requires = [
    "setuptools>=45",
    "wheel",
    "toml",
]
build-backend = "setuptools.build_meta"

This was first introduced in Issue #11, but is still undocumented.

I thought I was seeing the SetuptoolsDeprecationWarning when I ran poetry build, but that doesn't seem to be happening anymore.