From e2309df85ead6611394693ead92ca99a94caec4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sat, 6 Jun 2020 09:48:21 +0200 Subject: [PATCH] pythonPackages.pipBuildHook: do not build in an isolated environment When a PEP 517 project file is present, pip will not install prerequisites in `site-packages`: https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support For the shell hook, this has the consequence that the generated temporary directory that is added to PYTHONPATH does not contain `site.py`. As a result, Python does not discover the Python module. Thus when a user executes nix-shell in a project, they cannot import the project's Python module. This change adds the `--no-build-isolation` option to pip when creating the editable environment, to correctly generate `site.py`, even when a `pyproject.toml` is present. --- pkgs/development/interpreters/python/hooks/pip-build-hook.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh index 292f13d3015..6dd384b4847 100644 --- a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh @@ -24,7 +24,8 @@ pipShellHook() { export PATH="$tmp_path/bin:$PATH" export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH" mkdir -p "$tmp_path/@pythonSitePackages@" - @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" >&2 + @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" \ + --no-build-isolation >&2 fi runHook postShellHook