I haven't read those discussions in full (sorry to be lazy, but there's quite a lot there), but my initial take is that the rule doesn't apply to running setup.py scripts, where there's a greater need for backward compatibility. I think the rule about the CWD not being on sys.path only applies to loading a proper PEP 517 build backend when that's specified in pyproject.toml.

Furthermore, if the build backend then wants to run some code with the CWD on sys.path, I think it's free to do so, so this could be implemented in the setuptools backend. The rule is only for how the frontend loads the backend, not what the backend does afterwards.

Where a real PEP 517 backend needs to be loaded from the CWD (e.g. for Flit to bootstrap itself), we've already got the intreehooks package to make this possible: https://pypi.org/project/intreehooks/



On Sun, Jan 27, 2019, at 2:26 PM, Chris Jerdonek wrote:
For those of you who participated in the PEP 517 discussion during the summer of 2017 (just prior to its provisional acceptance), I want to flag that one of the issues discussed back then has now resurfaced for discussion. This is because the feature was turned on by default in pip's latest release (19.0) less than a week ago.

The issue is the one around whether the source directory should be included in sys.path. The resurfacing is more or less as predicted. For example, in one email [1] from August 29, 2017, Nick summarized the state of things by saying (not too long before provisional acceptance)--

So I think we can deem this one resolved in favour of "Frontends must ensure the current directory is *NOT* on sys.path before importing the designated backend", as starting there will mean we maximise our chances of learning something new as part of the initial rollout of the provisionally accepted API.

And also--

2. If omitting it is genuinely a problem, we'll likely find out soon enough as part of implementing a setup.py backend

Basically, that "soon enough" moment has arrived, and at least one discussion on how to resolve it has started on the tracker here:
https://github.com/pypa/pip/issues/6163

There is another discussion here, but it's probably better for the discussion to be in one spot:
https://github.com/pypa/setuptools/issues/1642
Maybe Discourse?

--Chris

[1]: https://mail.python.org/pipermail/distutils-sig/2017-August/031413.html

--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-leave@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at https://mail.python.org/archives/list/distutils-sig@python.org/message/LMGQS2DCMDFMMIYXH3A7ZDZN55P3CFMV/