[Distutils] Finishing up PEP 517

Nathaniel Smith njs at pobox.com
Tue Jun 27 23:43:41 EDT 2017

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!

> To put it another way, there are two build paths that backends are
> required to support:
> - in-place, direct from the original source tree
> - out-of-tree, from an unpacked sdist
> There's also a third, optional, build path for backends that define
> `prepare_wheel_input_files`:
> - out-of-tree, from a prepared wheel input directory

I would say that there's only one required path, which is in-place.
(But the tree that they do the in-place build in might have a more or
less complicated history). It worries me that you seem to think that
build_sdist and build_wheel should be coupled like this... this
proliferation of cases and the reification of "out of tree builds" as
a special thing that's different from an in-tree build in a temporary
tree is already what worried me about prepare_wheel_input_files, and
now it seems to be spreading :-).


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

More information about the Distutils-SIG mailing list