From 99699f99a51a9c8a8757d56fbff9cecf26ac252f Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 25 Feb 2024 16:30:12 +0000 Subject: [PATCH 1/2] python3Packages.pymatgen: 2022.3.29 -> 2024.2.23 addressing CVE-2024-23346 --- pkgs/development/python-modules/pymatgen/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pymatgen/default.nix b/pkgs/development/python-modules/pymatgen/default.nix index 545310ec0ade..f5238acbc044 100644 --- a/pkgs/development/python-modules/pymatgen/default.nix +++ b/pkgs/development/python-modules/pymatgen/default.nix @@ -24,7 +24,7 @@ buildPythonPackage rec { pname = "pymatgen"; - version = "2022.3.29"; + version = "2024.2.23"; format = "setuptools"; disabled = pythonOlder "3.8"; @@ -33,7 +33,7 @@ buildPythonPackage rec { owner = "materialsproject"; repo = "pymatgen"; rev= "v${version}"; - hash = "sha256-B2piRWx9TfKlGTPOAAGsq2GxyfHIRBVFpk6dxES0WF0="; + hash = "sha256-eswoup9ACj/PHVW3obcnZjD4tWemsmROZFtwGGigEYE="; }; nativeBuildInputs = [ From 4c1d7349ea2f64b256f1ca130baa48e17411ff8f Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 25 Feb 2024 16:31:21 +0000 Subject: [PATCH 2/2] python3Packages.pymatgen: enable tests also notice that the tests segfault on darwin suggesting the package is pretty broken on that platform --- .../python-modules/pymatgen/default.nix | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pymatgen/default.nix b/pkgs/development/python-modules/pymatgen/default.nix index f5238acbc044..cccf04f3a21a 100644 --- a/pkgs/development/python-modules/pymatgen/default.nix +++ b/pkgs/development/python-modules/pymatgen/default.nix @@ -1,8 +1,11 @@ { lib +, stdenv , buildPythonPackage , fetchFromGitHub +, ase , cython , glibcLocales +, joblib , matplotlib , monty , networkx @@ -12,10 +15,13 @@ , plotly , pybtex , pydispatcher +, pytestCheckHook +, pytest-xdist , pythonOlder , requests , ruamel-yaml , scipy +, seekpath , spglib , sympy , tabulate @@ -60,14 +66,37 @@ buildPythonPackage rec { uncertainties ]; - # Tests are not detected by pytest - doCheck = false; + nativeCheckInputs = [ + pytestCheckHook + pytest-xdist + ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + preCheck = '' + # hide from tests + mv pymatgen _pymatgen + # ensure tests can find these + export PMG_TEST_FILES_DIR="$(realpath ./tests/files)" + # some tests cover the command-line scripts + export PATH=$out/bin:$PATH + ''; + disabledTests = [ + # presumably won't work with our dir layouts + "test_egg_sources_txt_is_complete" + # borderline precision failure + "test_thermal_conductivity" + ]; + + passthru.optional-dependencies = { + ase = [ ase ]; + joblib = [ joblib ]; + seekpath = [ seekpath ]; + }; pythonImportsCheck = [ "pymatgen" ]; meta = with lib; { + broken = stdenv.isDarwin; # tests segfault. that's bad. description = "A robust materials analysis code that defines core object representations for structures and molecules"; homepage = "https://pymatgen.org/"; license = licenses.mit;