[Distutils] Fwd: Re: PEP 517 again

Thomas Kluyver thomas at kluyver.me.uk
Fri Aug 25 04:38:54 EDT 2017

On Fri, Aug 25, 2017, at 08:47 AM, Paul Moore wrote:
> I've never cared about whether the backend modifies the source tree,
> only that the direct-wheel / sdist->wheel equivalence holds.

If a user types 'pip install .' in a directory where they don't have
write permissions, what should happen?

1. The backend is capable of building without writing in that directory.
2. The frontend (pip) notices and pre-emptively copies to a writable tmp
3. The user accepts that the operation may fail, depending on the

I'd go for option 1 or 3.

Here's a proposed update to the build_wheel section of the PEP:

build_wheel(wheel_directory, config_settings=None,

Must build a .whl file, and place it in the specified wheel_directory.
It must return the basename (not the full path) of the .whl file it
creates, as a unicode string.

If the build frontend has previously called
prepare_metadata_for_build_wheel and depends on the wheel resulting from
this call to have metadata matching this earlier call, then it should
provide the path to the created .dist-info directory as the
metadata_directory argument. If this argument is provided, then
build_wheel MUST produce a wheel with identical metadata. The directory
passed in by the build frontend MUST be identical to the directory
created by prepare_metadata_for_build_wheel, including any unrecognized
files it created.

Backends which do not provide the prepare_metadata_for_build_wheel hook
may either silently ignore the metadata_directory parameter to
build_wheel, or else raise an exception when it is set to anything other
than None.

Wheels built by this hook should, as far as possible, be equivalent to
first building an sdist and then building a wheel from that sdist.
Frontends which wish to ensure this consistency may call build_sdist
(see below) first, and then call build_wheel in the unpacked sdist. But
if build_sdist fails with NotImplementedError, they will fall back to
calling build_wheel in the source directory, and rely on the backend to
produce an equivalent wheel.

The source directory may be read-only. Backends should therefore be
prepared to build without creating or modifying any files in the source
directory, but they may opt not to handle this case, in which case
failures will be visible to the user. Frontends are not responsible for
any special handling of read-only source directories.

The backend may store intermediate artifacts in cache locations or
temporary directories. The presence or absence of any caches should not
make a material difference to the final result of the build.

More information about the Distutils-SIG mailing list