[Distutils] A possible refactor/streamlining of PEP 517

Nick Coghlan ncoghlan at gmail.com
Mon Jul 17 08:04:53 EDT 2017


On 17 July 2017 at 21:30, Thomas Kluyver <thomas at kluyver.me.uk> wrote:
> On Mon, Jul 17, 2017, at 01:07 PM, Paul Moore wrote:
>> If we have a consensus here that "build a sdist and build a wheel from
>> it" is an acceptable/viable main route for pip to generate wheels
>> (with "just ask the backend" as fallback) then I'm OK with not
>> bothering with an "ask the backend to build a wheel out of tree"
>> option. My recollection of the history was that there was some
>> resistance in the past to pip going down the "build via sdist" route,
>> but if that's now considered OK in this forum, then I'm fine with
>> assuming that either I was mistaken or things have changed.
>
> I think I was one of the people arguing against going via an sdist. The
> important point for me is that an sdist is not a requirement for
> installing from source -  it's ok by me if it tries building an sdist
> first and then falls back to building a wheel directly.
>
> Since flit generates no intermediate artifacts, though, it's not an
> informative data point for where they should be placed.

Exactly, and this was the key point that Daniel's out-of-tree build
suggestion enabled: it *kept* the concept of on out-of-tree build that
was previously being kind-of-sort-of enabled by the
"prepare_input_for_build_wheel" hook, but changed it in such a way
that pure Python frontends like flit could effectively just ignore it
if they weren't going to attempt to emulate a limited version of a
via-sdist build (since they don't otherwise include any intermediate
build artifacts), while adapter backends like enscons could just pass
the config option down to the underlying build system.

At the same time, it allowed the decision on whether pip would fall
back to out-of-tree builds or in-place ones when building the sdist
failed to be deferred until PEP 517 support was actually being added
to pip.

While I do think it's still worthwhile to include the aspirational
guidance around backends trying to keep their out-of-tree builds as
close to the "build sdist -> unpack sdist -> build wheel" approach as
they can (as well as implementing the example backend that way), we
can also attempt to make it more explicit that frontends can only
*ensure* sdist-consistency by actually making an sdist first - while
backends are encouraged to make the two paths as consistent as they
can, they're not *required* to do so (which is the distinction that
allows both in-place and out-of-tree wheel builds to work in cases
where building the sdist will fail due to missing VCS metadata or
tools).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list