3 from typing import Optional
5 from pip._vendor.pyproject_hooks import BuildBackendHookCaller, HookMissing
7 from pip._internal.utils.subprocess import runner_with_spinner_message
9 logger = logging.getLogger(__name__)
12 def build_wheel_editable(
14 backend: BuildBackendHookCaller,
15 metadata_directory: str,
18 """Build one InstallRequirement using the PEP 660 build process.
20 Returns path to wheel if successfully built. Otherwise, returns None.
22 assert metadata_directory is not None
24 logger.debug("Destination directory: %s", tempd)
26 runner = runner_with_spinner_message(
27 f"Building editable for {name} (pyproject.toml)"
29 with backend.subprocess_runner(runner):
31 wheel_name = backend.build_editable(
33 metadata_directory=metadata_directory,
35 except HookMissing as e:
37 "Cannot build editable %s because the build "
38 "backend does not have the %s hook",
44 logger.error("Failed building editable for %s", name)
46 return os.path.join(tempd, wheel_name)