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.fetchpypi: fetch tarballs from pypi #20481

Closed
wants to merge 2 commits into from

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Nov 16, 2016

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.

This function grabs the url, version and hash for a specified package from a file that was generated by update-hashes.

@FRidh
Copy link
Member Author

FRidh commented Nov 16, 2016

Until we have fetchTarball with sha256 support I would like to use this script to update the hashes of the packages.

I could integrate it into the buildPythonPackage function, but what that function needs first is a version parameter, and converting all packages to use that is going to take time.

This function grabs the url, version and hash for a specified package from a file that was generated by update-hashes.
{
"Cycler": {
"sha256": "cd7b2d1018258d7247a71425e9f26463dfb444d411c39569972f4ce586b0c9d8",
"url": "https://files.pythonhosted.org/packages/c2/4b/137dea450d6e1e3d474e1d873cd1d4f7d3beed7e0dc973b06e8e10d32488/cycler-0.10.0.tar.gz",
Copy link
Member Author

Choose a reason for hiding this comment

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

We can get rid of the urls by relying on the translator.

@@ -2456,13 +2458,10 @@ in {
};

cycler = buildPythonPackage rec {
Copy link
Member

@Mic92 Mic92 Nov 16, 2016

Choose a reason for hiding this comment

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

I found buildPyPIPackage cool, because it can set meta, name and version attributes on its own.
Is there a reason for not using this approach?


let
data = builtins.fromJSON (builtins.readFile filename);
in pname: fetchurl {url=data.${pname}.url; sha256=data.${pname}.sha256; meta.version=data.${pname}.version;}
Copy link
Member

@Mic92 Mic92 Nov 16, 2016

Choose a reason for hiding this comment

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

How about?

in pname: with data.${pname}; fetchurl { inherit url sha256; meta.version = version;}

I'm not sure, but it could probably make a difference in performance, when the hash lookup only have to be done once.

@FRidh
Copy link
Member Author

FRidh commented Nov 17, 2016

@Mic92 thanks for the review.

As I wrote in #16005 we cannot use an external repo yet, because nix stable doesn't yet have fetchTarball with hash support. Even so, we could use the method with buildPyPIPackage and instead keep the json in this repo, like I do in this PR. I'm going to work on that approach, because that's in the direction we will go eventually anyway. The method I use here is also not so convenient for NixOS stable.

@FRidh FRidh closed this Nov 17, 2016
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.

2 participants