On Wed, Jun 27, 2018 at 8:00 AM, Pradyun Gedam firstname.lastname@example.org wrote:
On Sun, Jun 24, 2018 at 10:50 AM Nathaniel Smith email@example.com wrote:
To go a bit against the grain here, I think at this point I'd suggest that if "build-system.requires" is missing, it should be silently treated as if it had been set to ["setuptools", "wheel"]. Reasoning:
- Implementing this should require only a trivial amount of code, now
and in the long run. In particular, I'm *not* suggesting that if the "build-system.requires" key is missing then we should act like pyproject.toml is missing altogether -- that's a much more complex legacy code path that we'd like to eventually remove. I'm suggesting we literally do something like:
try: requires = config["build-system"]["requires"] except KeyError: requires = ["setuptools", "wheel"]
and then treat them exactly the same from then on.
Defaulting to this behavior means that the way source distribution is built changes (build isolation is enabled by pip) because configuration for a tool was added. This is surprising for users since one of things this means is they need to have provide wheels (so that pip that can find/use them) for `setuptools` and `wheel` to install packages. We've had multiple users report this on pip's tracker.
I'm not sure I understand the specific surprise you're talking about -- are you saying it's common for people to somehow find themselves in environments where setuptools and wheel are not installable?
Having users specify their build-requirements explicitly is a stronger opt-in that can used to explain the behavior in this case as that project using PEP 518 and build-isolation vs that project has configuration for towncrier. :)
The only other option is falling back to legacy behavior in this case, which obviously isn't what we want here.
This does make some sense. I'm pondering it :-). To make sure I understand, you're thinking of a scenario like:
<End user> Your software is broken! Installing it used to work fine, but now it's giving me an error saying 'can't install setuptools'! <Dev> Uh, that's weird, I'm not sure why that happens. Let me look into it. [...time passes...] <Dev> Okay, I figured it out: it's because we added a pyproject.toml file, and that switches on this 'build isolation' thing, which shouldn't make a difference, unless... does 'pip install setuptools' work for you? <End user> Oh yeah I didn't think it was worth mentioning, but we have a broken firewall where we have to manually download each package and install it one at a time. Do you think my not being able to install setuptools might have something to do with getting an error saying 'can't install setuptools'? <Dev> It's possible, yeah. <End user> So how are you going to fix it? <Dev> Well, we're not going to stop using towncrier because your firewall is broken, and even if we did then you'd have the same problem with like, every other Python package you ever want to install, so you should probably fix stuff on your end. Good luck.
And in particular, you're talking about trying to optimize that '[...time passes...]' part at the beginning: if the dev added a pyproject.toml just to use towncrier and never even realized that [build-system] sections are a thing that exists, then it might take them a while to figure out that the error message and the pyproject.toml file could be related. OTOH, if they were forced to type '[build-system] requires = ["setuptools", "wheel"]', then it increases the chances that a few months later when they get this request from a user, they'll think "hey, wasn't there something about setuptools that I touched recently.....?" and that will speed up their figuring it out. Have I understood all that correctly?
That all sounds like something that could happen, but it still feels a bit... tenuous, or something? If I were the dev here then there's an excellent chance that I'd have totally forgotten about that '[build-system]' stuff before the bug report comes in, and even if I haven't, the connection to their problem isn't obvious, and in any case knowing the issue doesn't really change the conclusion -- if someone can't install setuptools then that's the thing they need to fix. If this is a common scenario, then isn't the real solution for pip to print a better error message in the first place, so that the dev doesn't need to debug this from scratch?