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.nixpkgs: init at 0.2.2 #47169

Merged
merged 1 commit into from Sep 28, 2018
Merged

pythonPackages.nixpkgs: init at 0.2.2 #47169

merged 1 commit into from Sep 28, 2018

Conversation

t184256
Copy link
Contributor

@t184256 t184256 commented Sep 22, 2018

Allows to from nixpkgs import stuff in interactive Python sessions

Motivation for this change

I am a researcher and I use python and xonsh interactively a lot. While I appreciate the purity of Nix, sometimes I really want to violate it and pull in some dependency into my shell right now, without tearing my session down, editing and rebuilding an environment, and then recreating my session from history.

This module allows me to bypass all the Nix purity goodness in a whim, from nixpkgs import something and go on with my analysis. Yes, this is an abuse, but it's too convenient to pass up.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Fits CONTRIBUTING.md.

@t184256 t184256 requested a review from FRidh as a code owner September 22, 2018 14:31
@xeji
Copy link
Contributor

xeji commented Sep 22, 2018

@GrahamcOfBorg eval

@xeji
Copy link
Contributor

xeji commented Sep 22, 2018

cc @dotlambda

@t184256
Copy link
Contributor Author

t184256 commented Sep 22, 2018

Force-pushed to fix a trivial mistake, sorry for making it in the first place =/

@adisbladis
Copy link
Member

@t184256 It would be great if you could bump this PR to the latest version.

pkgs/top-level/python-packages.nix Outdated Show resolved Hide resolved
@t184256
Copy link
Contributor Author

t184256 commented Sep 28, 2018

That's a big whoops. Force-pushed to keep it squashed. Is it better now?

@t184256 t184256 changed the title pythonPackages.nixpkgs: init at 0.1.1 pythonPackages.nixpkgs: init at 0.2.1 Sep 28, 2018
inherit pname version;
sha256 = "0xrdk3n0jh8gwqflw9f4pj5dj43kq7ihdarmy396f95a353grp96";
};
buildInputs = with pkgs.python3Packages; [ pbr ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't reference python inputs by using pkgs.python3Packages since python3Packages may be pointing at a package set for a different interpreter.
This would break the following code: python35.withPackages(ps: [ ps.nixpkgs ]) since this would mix dependencies from python3.5 and python3.6.

The self variable is pointing at the correct package set for a given interpreter so use buildInputs = with self [ pbr ] instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@adisbladis
Copy link
Member

@GrahamcOfBorg build python3Packages.nixpkgs

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: python3Packages.nixpkgs

Partial log (click to expand)

writing dependency_links to nixpkgs.egg-info/dependency_links.txt
writing top-level names to nixpkgs.egg-info/top_level.txt
[pbr] Reusing existing SOURCES.txt
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/kcbgjnczh5r7y2005fsbay61l1aacj40-python3.6-nixpkgs-0.2.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python3Packages.nixpkgs

Partial log (click to expand)

writing dependency_links to nixpkgs.egg-info/dependency_links.txt
writing top-level names to nixpkgs.egg-info/top_level.txt
[pbr] Reusing existing SOURCES.txt
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/hnxfbb881iallwzsjaqrnxi7qmqdha2h-python3.6-nixpkgs-0.2.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python3Packages.nixpkgs

Partial log (click to expand)

writing dependency_links to nixpkgs.egg-info/dependency_links.txt
writing top-level names to nixpkgs.egg-info/top_level.txt
[pbr] Reusing existing SOURCES.txt
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/xw68zq50f9cjijjvkpj2b568j3ksm5pq-python3.6-nixpkgs-0.2.1

Allows to `from nixpkgs import` stuff in interactive Python sessions
@t184256 t184256 changed the title pythonPackages.nixpkgs: init at 0.2.1 pythonPackages.nixpkgs: init at 0.2.2 Sep 28, 2018
@adisbladis
Copy link
Member

This is an awesome hack! Thanks

@adisbladis adisbladis merged commit c1a66a4 into NixOS:master Sep 28, 2018
@t184256 t184256 deleted the nixpkgs-python-importer branch April 11, 2019 12:12
@t184256 t184256 restored the nixpkgs-python-importer branch July 23, 2019 22:25
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

5 participants