[Distutils] Finishing up PEP 517

Nathaniel Smith njs at pobox.com
Wed Jun 28 00:25:06 EDT 2017


On Tue, Jun 27, 2017 at 9:20 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 28 June 2017 at 13:43, Nathaniel Smith <njs at pobox.com> wrote:
>> On Tue, Jun 27, 2017 at 4:20 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> On 27 June 2017 at 18:54, Nathaniel Smith <njs at pobox.com> wrote:
>>>> On Tue, Jun 27, 2017 at 12:27 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>>>> 2. If you don't find the input preparation hook:
>>>>>
>>>>> - call `get_build_sdist_requires()`
>>>>> - call `get_build_wheel_requires()`
>>>>> - install both sets of additional dependencies
>>>>> - call `build_sdist()`
>>>>> - unpack the sdist into the build directory
>>>>> - call `build_wheel()`
>>>>
>>>> Side note: I think this is wrong -- I think you can't call
>>>> get_build_wheel_requires until after you've unpacked the sdist,
>>>> because that's a whole new tree that might be arbitrarily different.
>>>> (In practice I guess this should never happen, but we should be clear
>>>> conceptually I think.)
>>>
>>> No, both `get_build_wheel_requires()` and `build_wheel()` also have to
>>> work in-place - backends aren't allowed to assume that *all* builds
>>> will be out-of-tree, even though pip specifically is expected to work
>>> that way. Neither of these hooks is allowed to give different results
>>> depending on whether you're doing an in-place or out-of-tree build.
>>
>> Right. But if you're building and sdist and unpacking it and then
>> calling build_wheel there, then that's not an out-of-tree build, it's
>> an in-tree build in a new tree. The wheel hooks are certainly allowed
>> to give different results in a VCS-tree and an unpacked-sdist-tree,
>> they have different pyproject.toml files!
>
> Umm, no. The pyproject.toml file MUST NOT change when building the
> sdist. It's a human-managed input file - if any step of the build
> process mutates it, that step is *broken*.

I agree that changing the pyproject.toml file is a terrible idea in most cases

I still think we should do the "right thing" when it happens, where
"right" means "doesn't involve complex underspecified coupling between
conceptually distinct phases", because this thing needs to fit in
people's brains. It's not so much that pyproject.toml changing is an
important case, as that if we can even *tell* whether it changed then
there's something wrong with our architecture.

pyproject.toml is just an example anyway; get_build_wheel_requires
runs arbitrary code, and that code could potentially return different
results in different trees.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Distutils-SIG mailing list