berberman / nvfetcher

Generate nix sources expr for the latest version of packages
https://nvfetcher.torus.icu
MIT License
178 stars 15 forks source link

[feature] get wheel from PYPI? #106

Open Freed-Wu opened 1 year ago

Freed-Wu commented 1 year ago

Now fetch.pypi only can get the sdist. How can we get wheel?

    src = fetchurl {
      url = "https://pypi.org/packages/source/f/foo-bar/foo-bar-0.0.1.tar.gz";
      sha256 = "sha256-LpqOFSAPgw3roaocDRQpajPyt+twvce4KY/kZD9xAY4=";
    };
berberman commented 8 months ago

Shouldn't fetch.url work as long as you have the url?

Freed-Wu commented 8 months ago

nvfetcher.toml:

[feeluown]
src.pypi = "feeluown"
fetch.pypi = "feeluown"
{ fetchgit, fetchurl, fetchFromGitHub }:
{
  feeluown = {
    pname = "feeluown";
    version = "3.8.2";
    src = fetchurl {
      url = "https://pypi.io/packages/source/f/feeluown/feeluown-3.8.2.tar.gz";
      sha256 = "sha256-V2yzpkmjRkipZOvQGB2mYRhiiEly6QPrTOMJ7BmyWBQ=";
    };
  };
}

How to

{ fetchgit, fetchurl, fetchFromGitHub }:
{
  feeluown = {
    pname = "feeluown";
    version = "3.8.2";
    src = fetchurl {
      url = "the url of wheel";
      sha256 = "";
    };
  };
}
berberman commented 8 months ago

Sorry, did you mean to fetch a wheel instead of the source code for a python package? Do we know the url of the wheel given the package name?

Freed-Wu commented 8 months ago

https://wiki.archlinux.org/title/Python_package_guidelines#Source:

Pure Python wheel package https://files.pythonhosted.org/packages/py2.py3/${_name::1}/$_name/${_name//-/_}-$pkgver-py2.py3-none-any.whl (Bilingual – Python 2 and Python 3 compatible) https://files.pythonhosted.org/packages/py3/${_name::1}/$_name/${_name//-/_}-$pkgver-py3-none-any.whl (Python 3 only) Note that the distribution name can contain dashes, while its representation in a wheel filename cannot (they are converted to underscores).