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

nbstripout: wrap the executable #26151

Closed
wants to merge 1 commit into from

Conversation

jluttine
Copy link
Member

Motivation for this change

Without wrapping, installing nbstripout adds Python, Jupyter and some other
run-time dependencies to PATH. With wrapping, they are only visible to
nbstripout.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
jluttine Jaakko Luttinen
Without wrapping, installing nbstripout adds Python, Jupyter and some other
run-time dependencies to PATH. With wrapping, they are only visible to
nbstripout.
@jluttine
Copy link
Member Author

See #26146 for the general issue report.

@FRidh
Copy link
Member

FRidh commented May 27, 2017

When does it add all those dependencies to PATH? Are you using nix-shell?

@FRidh
Copy link
Member

FRidh commented May 27, 2017

Indeed, you are using nix-shell. nix-shell opens a shell to develop a package, and therefore runs certain hooks, which you are now not interested in. Until we get a nix run command there's not much we can do about it.

@jluttine
Copy link
Member Author

Yes. This is what I did (results without this fix):

$ nix-shell -p nbstripout -p which --pure

Now, python and jupyter have been added to PATH:

$ which python
/nix/store/83xv5vjqs8qxzdsqs8dmni23wfkbx43a-python-2.7.13/bin/python
$ which jupyter
/nix/store/78iqhpa3k46ywjc5b9vm2gm5paarpf9p-python2.7-jupyter_core-4.3.0/bin/jupyter

Also, the Python dependencies are in PYTHONPATH:

$ python -c "import nbformat"; echo $?
0

@FRidh
Copy link
Member

FRidh commented May 27, 2017

I'm closing this because this is a "limitation" of nix-shell. The proper solution is either waiting for a nix run command or, preferably, implement a proper buildPythonApplication function that works somewhat like what you wrote and this #16672.

@FRidh FRidh closed this May 27, 2017
@jluttine
Copy link
Member Author

Ok. And you're right, I tested: if I added nbstripout to my pkgs in configuration.nix, the dependencies aren't added to my environment, only nbstripout. I did not know that there is such a difference to nix-shell.

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

2 participants