diff --git a/pkgs/development/python-modules/dscribe/default.nix b/pkgs/development/python-modules/dscribe/default.nix index 33229ab03075..c2644b3da134 100644 --- a/pkgs/development/python-modules/dscribe/default.nix +++ b/pkgs/development/python-modules/dscribe/default.nix @@ -1,47 +1,85 @@ { - buildPythonPackage, lib, + stdenv, + buildPythonPackage, fetchFromGitHub, - numpy, - scipy, + + # build-system + pybind11, + setuptools, + + # dependencies ase, joblib, - sparse, - pybind11, + numpy, scikit-learn, + scipy, + sparse, + + # tests + pytestCheckHook, }: buildPythonPackage rec { pname = "dscribe"; version = "2.1.1"; + pyproject = true; + src = fetchFromGitHub { owner = "singroup"; repo = "dscribe"; - rev = "v${version}"; + tag = "v${version}"; fetchSubmodules = true; # Bundles a specific version of Eigen hash = "sha256-2JY24cR2ie4+4svVWC4rm3Iy6Wfg0n2vkINz032kPWc="; }; - pyproject = true; - build-system = [ pybind11 + setuptools ]; dependencies = [ - numpy - scipy ase joblib - sparse + numpy scikit-learn + scipy + sparse ]; - meta = with lib; { + pythonImportsCheck = [ + "dscribe" + "dscribe.ext" + ]; + + # Prevents python from loading dscribe from the current working directory instead of using $out + preCheck = '' + rm -rf dscribe + ''; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = + [ + # AttributeError: module 'numpy' has no attribute 'product' + "test_extended_system" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # AssertionError on a numerical test + "test_cell_list" + + # Fatal Python error: Aborted + # matplotlib/backend_bases.py", line 2654 in create_with_canvas + "test_examples" + ]; + + meta = { description = "Machine learning descriptors for atomistic systems"; homepage = "https://github.com/SINGROUP/dscribe"; - license = licenses.asl20; - maintainers = [ maintainers.sheepforce ]; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.sheepforce ]; }; }