scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
404 stars 68 forks source link

pyproject.toml is missing build-system section #243

Closed mgorny closed 1 year ago

mgorny commented 1 year ago

The pyproject.toml file is missing the build-system section that specifies which PEP517 build system should be used. Given that setup.py no longer exists, the behavior expected from PEP517 builders is undefined and largely unpredictable. Please add a build-system section and specify which build system is expected to be used.

scott-griffiths commented 1 year ago

Hmmm, I found the documentation on using pyproject.toml rather confusing and eventually decided it didn't need that section as all the setup.py information was already present. I mean it does actually build (at least on my machine!)

Reading the docs I think it should be fine. From https://peps.python.org/pep-0518/

"If the file exists but is lacking the [build-system] table then the default values as specified above should be used. "

where the default values are

[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel"]  # PEP 508 specifications.

So it should build OK (or at least it is defined). Is this failing in a particular case?

mgorny commented 1 year ago

Yes, in Gentoo we run the legacy code path only if setup.py is present. For PEP517 builds, you should always explicitly specify the correct build system, especially that this file doesn't make it clear which build system is to be used.

https://setuptools.pypa.io/en/latest/userguide/quickstart.html#basic-use specifies the correct block for setuptools:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

Since you're using the experimental pyproject.toml support, you should also set minimal setuptools version to >= 61.0.0 there, otherwise this will fail in confusing ways if user has old setuptools version.

scott-griffiths commented 1 year ago

I've now added the [build-system] into main. 1d02d003d6bbb81a7a26d64bc970b57770944523

I'll probably create a new release in a week or two with this change included.

@mgorny : If you could check that this will work for you that would be helpful as it was never failing for me, so I can't verify the fix.

mgorny commented 1 year ago

Thanks. The build-system section looks good but there's still something wrong: setuptools creates an empty wheel for me. This has probably something to do with the new package discovery logic in setuptools, might be a bug there. I'm investigating.

mgorny commented 1 year ago

Ah, nevermind that. It seems to only happen when --wheel-dir is ., i.e. because I was lazy while testing it ;-). You can ignore that for normal use cases, and I'll report a bug to setuptools.

mgorny commented 1 year ago

Filed https://github.com/pypa/setuptools/issues/3692 for that.

scott-griffiths commented 1 year ago

Fixed in 4.0.2