diff --git a/pkgs/development/python-modules/ripser/default.nix b/pkgs/development/python-modules/ripser/default.nix index d67de41c6d75..60e3235ede62 100644 --- a/pkgs/development/python-modules/ripser/default.nix +++ b/pkgs/development/python-modules/ripser/default.nix @@ -1,53 +1,86 @@ { lib, + stdenv, buildPythonPackage, + fetchFromGitHub, + + # build-system cython, - fetchPypi, numpy, + setuptools, + persim, - pytestCheckHook, - pythonOlder, scikit-learn, scipy, + + # tests + pytestCheckHook, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { pname = "ripser"; version = "0.6.10"; - format = "setuptools"; + pyproject = true; - disabled = pythonOlder "3.6"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-3Mr6+XrSOVvGbLN25fvg9vJkNyspj9CT5BBxMsH3lIQ="; + src = fetchFromGitHub { + owner = "scikit-tda"; + repo = "ripser.py"; + tag = "v${version}"; + hash = "sha256-w6d/JRBYoxvu1r02WbwfG94GvB1NGG2Rwd5maSNYPhg="; }; - nativeBuildInputs = [ cython ]; + build-system = [ + cython + numpy + setuptools + ]; - propagatedBuildInputs = [ + dependencies = [ numpy scipy scikit-learn persim ]; - nativeCheckInputs = [ pytestCheckHook ]; + pythonImportsCheck = [ "ripser" ]; + + nativeCheckInputs = [ + pytestCheckHook + writableTmpDirAsHomeHook + ]; preCheck = '' # specifically needed for darwin - export HOME=$(mktemp -d) mkdir -p $HOME/.matplotlib echo "backend: ps" > $HOME/.matplotlib/matplotlibrc ''; - pythonImportsCheck = [ "ripser" ]; + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ + # AssertionError + # assert np.isinf(h0[0, 1]) + "test_full_nonzerobirths" + # assert np.max(np.abs(h11 - h12)) <= 2 * res2["r_cover"] + "test_greedyperm_circlebottleneck" + # assert np.all(dgm[:,1] >= dgm[:,0]) + "test_returns_dgm" + # assert tuple(dgm[0]) == (0,np.inf) + # assert (np.float64(0....float64(0.0)) == (0, inf) + "test_single_point" + # assert res0["num_edges"] == res1["num_edges"] + # assert 2307 == 167 + "test_sparse" + # assert 38 < 38 + "test_thresh" + # assert(np.allclose(r1, r2)) + "test_zero_edge_bug" + ]; - meta = with lib; { + meta = { description = "Lean Persistent Homology Library for Python"; homepage = "https://ripser.scikit-tda.org"; changelog = "https://github.com/scikit-tda/ripser.py/blob/${version}/CHANGELOG.md"; - license = licenses.mit; + license = lib.licenses.mit; maintainers = [ ]; }; }