In case it’s helpful, and to close this side discussion, the appropriate answers to a “should” question are “yes”, “no”, or “I don’t know, let me go and find out whether it’s yes or no”. Any other response is actually an argument, trying to convince the person who asked it that the question is incorrect (and yes, that’s what my responses were).
I appreciate the retitle.
How can build backends avoid breaking users when they make backwards incompatible changes?
As I facetiously said above, by not making them. But as I also said above in all seriousness, this is not in any way unique to build backends. Any library that changes their interface is going to create issues like this, and their options ultimately are to not make the changes, or to communicate a transition plan very clearly that leads all of their users to be unaffected by the change (which is much much harder than simply not making the change).
However, even though it’s now my framing of the question, I think what we actually want here is:
How can build front ends avoid breaking users when the build backend makes backwards incompatible changes and the package has not indicated that it has any particular needs?
This starts getting us into the space where interesting options exist. Better UX for constraints files is one idea, and a couple of possible directions:
- a virtual
package_name
environment marker in constraints
- a TOML based format with per package tables for build dependencies
- environment variables per package for build dependency constraints
- plan a build script that can be modified by the user before running it (e.g. write out each command individually so the user can just run a single script to build/install everything after modifications)
- date-based build dependency resolution that applies an implicit upper bound of the release date of the package being built
Whether any of these are good ideas or not is very open to discussion, I’m just brainstorming. As a build backend maintainer, I’m happy enough with any of these being applied to packages that use my backend (though I’d likely override the date-based one on my own installs, because I often fix bugs in the backend that improve older versions… but then I almost always get my own wheels, so it’s no big deal either way).
It seems the front ends already accurately report that the backend is responsible for the failure, as those issues show, so there’s probably not much that can be done there.
In some cases, some front ends do report mild incompatibilities in a way that appears like breakage - thinking of PyPI rejecting unnormalised names and directory structures. Front ends could be flexible in what they accept (and strict in what they produce), which ought to reduce the amount of breakage users actually see. (Backends could also be flexible in what they accept and strict in what they produce, which would also help, but my reframed question puts them out of scope right now.)
I think this is just because the constraints file applies to build dependencies largely by accident
The environment variable naturally flowed through to isolated environment creation, though once we realised that this is actually a very useful thing, it’s no doubt been formalised.
It’s certainly possible. Though when the topic is users being surprised that their code that has worked for 10+ years suddenly breaks, well, setuptools is really the only possible culprit. None of the other have been around that long, and don’t have the history.