Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP-662: Add prepare_metadata_for_build_editable #2003

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions pep-0662.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,33 @@ called.

If not defined, the default implementation is equivalent to returning ``[]``.

``prepare_metadata_for_build_editable``
---------------------------------------

::

def prepare_metadata_for_build_editable(metadata_directory, config_settings=None):
...

Must create a ``.dist-info`` directory containing wheel metadata
inside the specified ``metadata_directory`` (i.e., creates a directory
like ``{metadata_directory}/{package}-{version}.dist-info/``). This
directory MUST be a valid ``.dist-info`` directory as defined in the
wheel specification, except that it need not contain ``RECORD`` or
signatures. The hook MAY also create other files inside this
directory, and a build frontend MUST preserve, but otherwise ignore, such files;
the intention here is that in cases where the metadata depends on build-time
decisions, the build backend may need to record these decisions in
some convenient format for re-use by the actual wheel-building step.

This must return the basename (not the full path) of the ``.dist-info``
directory it creates, as a unicode string.

If a build frontend needs this information and the method is
not defined, it should call ``build_editable`` and look at the resulting
metadata directly.


``build_editable``
------------------

Expand All @@ -177,16 +204,16 @@ must return the basename (not the full path) of the ``.whl`` file it creates,
as a unicode string. The wheel file must be of type virtual wheel as defined
under the terminology section.

If the build frontend has previously called ``prepare_metadata_for_build_wheel``
If the build frontend has previously called ``prepare_metadata_for_build_editable``
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_editable`` 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``,
identical to the directory created by ``prepare_metadata_for_build_editable``,
including any unrecognized files it created.

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

Expand Down Expand Up @@ -245,7 +272,7 @@ value must be a ``file://`` URL pointing to the project directory (i.e., the
directory containing ``pyproject.toml``), and the ``dir_info`` value must be
``{'editable': true}``.

The frontend can rely on the ``prepare_metadata_for_build_wheel`` hook when
The frontend can rely on the ``prepare_metadata_for_build_editable`` hook when
installing in editable mode.

If the frontend concludes it cannot achieve an editable installation with the
Expand Down