[Distutils] Finishing up PEP 517
Nathaniel Smith
njs at pobox.com
Tue Jun 27 04:54:26 EDT 2017
On Tue, Jun 27, 2017 at 12:27 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 26 June 2017 at 22:36, Nathaniel Smith <njs at pobox.com> wrote:
>> On Jun 25, 2017 12:46 AM, "Nick Coghlan" <ncoghlan at gmail.com> wrote:
>>
>> On 25 June 2017 at 17:41, Nathaniel Smith <njs at pobox.com> wrote:
>>> Maybe you're right and there are exactly 2 front-end use cases and it
>>> will turn out that the current PEP addresses them perfectly. I don't
>>> have a crystal ball; I'm making an argument from ignorance.
>>
>> I'm not - we have two concrete potential consumers of the interface
>> (pip and tox, aka "build to use" and "build to test"), and I'm
>> designing the interface to cover their needs (i.e. out-of-tree wheel
>> builds and actual sdists).
>>
>> If we discover other use cases later, we'll worry about them then (and
>> the easy of doing so is the nicest benefit of defining this as a
>> Python API), but the temptation to design in hyper-flexibility now
>> falls under YAGNI (You Ain' Gonna Need It).
>>
>>
>> My proposal also covers their needs AFAICT?
>
> No, as you don't know in your proposal whether or not build_sdist can
> fail until after you've already called it, and you always need to call
> both `get_build_sdist_requires()` and `build_sdist()`, even if you
> only care about doing an out-of-tree wheel build.
Ah, this is an interesting point, thank you! I hadn't thought of that.
But... it doesn't seem like a big deal in practice? If a build backend
knows that it can't build an sdist from a given tree, then its
get_build_sdist_requires hook (which is arbitrary code after all) can
surely figure this out and return []. Or we could allow
get_build_sdist_requires to also return NotImplemented (defining that
to mean "building sdists is not implemented, don't even try calling
build_sdist"), though maybe that's unnecessary fiddliness.
> 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.)
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the Distutils-SIG
mailing list