For one thing, in the spec I mentioned above, this is not even guaranteed to work, but also because I am not trying to actively prevent people from being able to add '' to their sys.path, I don’t care about that. I just want it to happen in the backend, not in the frontend. Among the problems with build-backend-location='.' just adding the source root to the PATH is that it’s way too broadly scoped.
We should 100% be optimizing for people implementing front-ends, not self-bootstrapping backends. Pretty much the only person who ever has to implement this is setuptools. Everyone else is opting in. On the other hand, every single front-end must implement this functionality.
There is zero reason to make this any more general than it absolutely needs to be. The proposal of a fixed __build_backend__.py can be simply implemented like this:
if build_backend_name == "<bootstrap>":
import sys
sys.path.insert(0, '')
build_backend = __import__('__build_backend__.py')
sys.path[:] = sys.path[1:] # Not required by the spec
else:
build_backend = __import__(build_backend_name)
No fuss, no muss.
Frankly, if the implementation gets too complicated, the simplest thing is to change PEP 517 to say that backends must be built from a wheel and be done with it. --no-binary :all: would just have to be changed so that it doesn’t apply to the PEP 517 build requirements.