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

pythonPackages.pipBuildHook: do not build in an isolated environment #89607

Merged
merged 2 commits into from Jun 8, 2020

Conversation

danieldk
Copy link
Contributor

@danieldk danieldk commented Jun 6, 2020

Motivation for this change

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.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@danieldk danieldk requested a review from FRidh as a code owner June 6, 2020 07:57
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/install-python-withpackages-along-with-python-setup-py-develop-package-for-org-babel-accessibility/7160/7

@FRidh
Copy link
Member

FRidh commented Jun 6, 2020

Looks good. Just needs to target staging because this is a mass-rebuild.

@danieldk danieldk changed the base branch from master to staging June 6, 2020 08:02
@danieldk
Copy link
Contributor Author

danieldk commented Jun 6, 2020

I'll rebase it! Just letting the GitHub interface do the work doesn't seem to do the trick ;).

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.
…onment

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.
@danieldk
Copy link
Contributor Author

danieldk commented Jun 8, 2020

@FRidh thanks! I rebased it, any other changes that need to be made?

@FRidh FRidh merged commit 5f47c36 into NixOS:staging Jun 8, 2020
@danieldk danieldk deleted the pep-517-shellhook-fix branch June 8, 2020 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants