diff --git a/pkgs/development/python-modules/scikit-hep-testdata/default.nix b/pkgs/development/python-modules/scikit-hep-testdata/default.nix new file mode 100644 index 000000000000..281564601102 --- /dev/null +++ b/pkgs/development/python-modules/scikit-hep-testdata/default.nix @@ -0,0 +1,47 @@ +{ lib +, fetchFromGitHub +, pythonAtLeast +, buildPythonPackage +, importlib-resources +, pyyaml +, requests +, pytestCheckHook +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "scikit-hep-testdata"; + version = "0.4.3"; + format = "pyproject"; + + # fetch from github as we want the data files + # https://github.com/scikit-hep/scikit-hep-testdata/issues/60 + src = fetchFromGitHub { + owner = "scikit-hep"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-3uy2uZb0Y9nOHlXtsDd9LGALvTXl1ZQ6P3m2dQ2ceHo="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + propagatedBuildInputs = [ + pyyaml + requests + ] ++ lib.optional (!pythonAtLeast "3.9") importlib-resources; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + SKHEP_DATA = 1; # install the actual root files + + doCheck = false; # tests require networking + pythonImportsCheck = [ "skhep_testdata" ]; + + meta = with lib; { + homepage = "https://github.com/scikit-hep/scikit-hep-testdata"; + description = "A common package to provide example files (e.g., ROOT) for testing and developing packages against"; + license = licenses.bsd3; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/uproot/default.nix b/pkgs/development/python-modules/uproot/default.nix new file mode 100644 index 000000000000..8a687534005e --- /dev/null +++ b/pkgs/development/python-modules/uproot/default.nix @@ -0,0 +1,61 @@ +{ lib +, fetchFromGitHub +, buildPythonPackage +, awkward +, numpy +, lz4 +, xxhash +, zstandard +, pytestCheckHook +, scikit-hep-testdata +}: + +buildPythonPackage rec { + pname = "uproot"; + version = "4.0.8"; + + # fetch from github for tests + src = fetchFromGitHub { + owner = "scikit-hep"; + repo = "uproot4"; + rev = version; + sha256 = "sha256-E9BRgyMz+3Xl8Q1zsnVtvW44FXTqs29U1oK4te0myq4="; + }; + + propagatedBuildInputs = [ + awkward + numpy + lz4 + xxhash + zstandard + ]; + + checkInputs = [ + pytestCheckHook + scikit-hep-testdata + ]; + preCheck = '' + export HOME="$(mktemp -d)" + ''; + disabledTests = [ + # tests that try to download files + "test_http" + "test_no_multipart" + "test_fallback" + "test_pickle_roundtrip_http" + ]; + disabledTestPaths = [ + # tests that try to download files + "tests/test_0066-fix-http-fallback-freeze.py" + "tests/test_0088-read-with-http.py" + "tests/test_0220-contiguous-byte-ranges-in-http.py" + ]; + pythonImportsCheck = [ "uproot" ]; + + meta = with lib; { + homepage = "https://github.com/scikit-hep/uproot4"; + description = "ROOT I/O in pure Python and Numpy"; + license = licenses.bsd3; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b92607502d92..50d02dbfdffe 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7471,6 +7471,8 @@ in { scikit-fuzzy = callPackage ../development/python-modules/scikit-fuzzy { }; + scikit-hep-testdata = callPackage ../development/python-modules/scikit-hep-testdata { }; + scikitimage = callPackage ../development/python-modules/scikit-image { }; scikit-learn = callPackage ../development/python-modules/scikit-learn { @@ -8610,6 +8612,8 @@ in { upnpy = callPackage ../development/python-modules/upnpy { }; + uproot = callPackage ../development/python-modules/uproot { }; + uproot3 = callPackage ../development/python-modules/uproot3 { }; uproot3-methods = callPackage ../development/python-modules/uproot3-methods { };