Introduce basic pyproject.toml, supporting existing build methods only #2687
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issues/PRs: #2651, #1253, #2104
Does not close any of them, except maybe #1253, as it only allows existing builds to continue working as before.
This PR adds a basic pyproject.toml file to the project. I limited the scope here to only have the existing build infrastructure, in GitHub actions and
python build.py bdist_wheel
locally (after having the other build steps done). It doesn't magically transform the builds that would make latest-and-greatest build methods now work that didn't work before. But it allows us to now build upon that and gradually reduce customizations when possible, and safely add configuration for tools into the pyproject.toml that can help us improve the global quality of the project.Why do so little? I tried many many different ways, and even 80+ commits later, some things still didn't work everywhere, and the behaviour was different in many ways, which was hard to know if something could be a breaking change or not. Here, I kept it simple, only what was needed to get the same artifact with our existing commands.
So, the changes:
[project]
table.[build-system]
table with the build-backend (set to the same fallback value as if it wasn't there). The__legacy__
insetuptools.build_meta:__legacy__
instead ofsetuptools.build_meta
that should be used is because we currently rely on the old behaviour of having that root folder on the python search path, that isn't the case when a pyproject.toml file is present. (opts-in to some new modern defaults).requirements/devel.txt
isn't useful anymore, in regard to what is needed when building. Not having "requests" listed there, for example, even if installed in CI, means it will not be available in the isolated env that would be used when building. Nothing else is present in that env.requirements/devel.txt
is still kept for now, in order to have a state to revert to/compare to later on.requests
to removerequests[security]
that is a no-op since years. It solves a package resolution problem where pip was trying all the combinations of older dependencies to satisfy this.wheels
package. Simply use setuptools as suggested, and lower-bound the version of setuptools that includes that change. October 2025 is really near, and possibly the existing builds, even without this PR, wouldn't work anymore.setup()
call, as it fails the builds in the wheel stage as it expects a value, since these were declared as dynamic in the pyproject.toml. The values were copied from the mainsetup.py
, and are not useful as such. They can be removed when the dynamic fields in question are ported to the pyproject.toml file later on. This means that I didn't have to mess around with changing the build mechanism of that cython module, which retarded this PR by 3-4 weeks when trying to make the builds fork with that extension module inside the main setup.py to avoid the dynamic metadata failure described above.Apart from the changes seen in this PR, and the version numbers from vcs, the sdist is the same between main and this PR.
For Win x64 Python 3.13 wheels, same thing, except the LICENSE.txt of the .dist-info is utf8 with unix line endings (expected), and the usual variations in the compiled extensions.
Windows x86 python 3.9 wheels has the same kinds of changes as win x64 python 3.13 wheels.
macOS 3.13 wheel has only the version number related differences and the extension module differences (that impact checksums).
I would like this PR to be squashed-merged as a single commit. It is not intended to be bisected anyways, and my development wasn't oriented to be clean when debugging CI. (I know I cleaned a bit when rebasing, but still)