python312Packages.monty: cleanup & add missing test dependency (#382662)
This commit is contained in:
@@ -2,18 +2,37 @@
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
msgpack,
|
||||
numpy,
|
||||
pandas,
|
||||
pydantic,
|
||||
pymongo,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
ruamel-yaml,
|
||||
|
||||
# build-system
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
|
||||
# dependencies
|
||||
msgpack,
|
||||
ruamel-yaml,
|
||||
|
||||
# optional-dependencies
|
||||
coverage,
|
||||
pymongo,
|
||||
pytest,
|
||||
pytest-cov,
|
||||
types-requests,
|
||||
sphinx,
|
||||
sphinx-rtd-theme,
|
||||
orjson,
|
||||
pandas,
|
||||
pydantic,
|
||||
pint,
|
||||
torch,
|
||||
tqdm,
|
||||
invoke,
|
||||
requests,
|
||||
|
||||
# tests
|
||||
ipython,
|
||||
numpy,
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -21,8 +40,6 @@ buildPythonPackage rec {
|
||||
version = "2025.1.9";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.9";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "materialsvirtuallab";
|
||||
repo = "monty";
|
||||
@@ -30,44 +47,63 @@ buildPythonPackage rec {
|
||||
hash = "sha256-+9nxuvrtl04Fb+GQJUn+fxg4sq1pXK59UkUTkKH16YQ=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace tests/test_os.py \
|
||||
--replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
setuptools
|
||||
setuptools-scm
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
msgpack
|
||||
ruamel-yaml
|
||||
tqdm
|
||||
];
|
||||
|
||||
optional-dependencies = rec {
|
||||
ci = [
|
||||
coverage
|
||||
pymongo
|
||||
pytest
|
||||
pytest-cov
|
||||
types-requests
|
||||
] ++ optional;
|
||||
dev = [ ipython ];
|
||||
docs = [
|
||||
sphinx
|
||||
sphinx-rtd-theme
|
||||
];
|
||||
json =
|
||||
[
|
||||
orjson
|
||||
pandas
|
||||
pydantic
|
||||
pymongo
|
||||
]
|
||||
++ lib.optionals (pythonOlder "3.13") [
|
||||
pint
|
||||
torch
|
||||
];
|
||||
multiprocessing = [ tqdm ];
|
||||
optional = dev ++ json ++ multiprocessing ++ serialization;
|
||||
serialization = [ msgpack ];
|
||||
task = [
|
||||
invoke
|
||||
requests
|
||||
];
|
||||
};
|
||||
|
||||
nativeCheckInputs = [
|
||||
ipython
|
||||
numpy
|
||||
pandas
|
||||
pydantic
|
||||
pymongo
|
||||
pytestCheckHook
|
||||
torch
|
||||
tqdm
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "monty" ];
|
||||
|
||||
disabledTests = [
|
||||
# Test file was removed and re-added after 2022.9.9
|
||||
"test_reverse_readfile_gz"
|
||||
"test_Path_objects"
|
||||
"test_zopen"
|
||||
"test_zpath"
|
||||
# flaky, precision/rounding error
|
||||
"TestJson.test_datetime"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Serves as a complement to the Python standard library by providing a suite of tools to solve many common problems";
|
||||
longDescription = "
|
||||
Monty implements supplementary useful functions for Python that are not part of the
|
||||
@@ -75,8 +111,8 @@ buildPythonPackage rec {
|
||||
patterns such as singleton and cached_class, and many more.
|
||||
";
|
||||
homepage = "https://github.com/materialsvirtuallab/monty";
|
||||
changelog = "https://github.com/materialsvirtuallab/monty/releases/tag/${src.tag}";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ psyanticy ];
|
||||
changelog = "https://github.com/materialsvirtuallab/monty/releases/tag/v${version}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ psyanticy ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,46 +1,65 @@
|
||||
{
|
||||
lib,
|
||||
ase,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
cython,
|
||||
pythonAtLeast,
|
||||
fetchFromGitHub,
|
||||
|
||||
# build-system
|
||||
setuptools,
|
||||
|
||||
# nativeBuildInputs
|
||||
cython,
|
||||
glibcLocales,
|
||||
|
||||
# dependencies
|
||||
joblib,
|
||||
matplotlib,
|
||||
monty,
|
||||
networkx,
|
||||
oldest-supported-numpy,
|
||||
numpy,
|
||||
palettable,
|
||||
pandas,
|
||||
plotly,
|
||||
pybtex,
|
||||
pydispatcher,
|
||||
pytest-xdist,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
requests,
|
||||
ruamel-yaml,
|
||||
scipy,
|
||||
seekpath,
|
||||
setuptools,
|
||||
spglib,
|
||||
sympy,
|
||||
tabulate,
|
||||
tqdm,
|
||||
uncertainties,
|
||||
|
||||
# optional-dependencies
|
||||
netcdf4,
|
||||
ase,
|
||||
pytest,
|
||||
pytest-cov,
|
||||
invoke,
|
||||
sphinx,
|
||||
sphinx-rtd-theme,
|
||||
numba,
|
||||
vtk,
|
||||
|
||||
# tests
|
||||
addBinToPathHook,
|
||||
pytest-xdist,
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pymatgen";
|
||||
version = "2025.1.9";
|
||||
version = "2025.1.24";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
disabled = pythonAtLeast "3.13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "materialsproject";
|
||||
repo = "pymatgen";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-mbXnuqgve8YjktJ2PSaMNk8ADioaGe+W12bYm/chpzE=";
|
||||
hash = "sha256-0P3/M6VI2RKPArMwXD95sjW7dYOTXxUeu4tOliN0IGk=";
|
||||
};
|
||||
|
||||
build-system = [ setuptools ];
|
||||
@@ -51,49 +70,107 @@ buildPythonPackage rec {
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
joblib
|
||||
matplotlib
|
||||
monty
|
||||
networkx
|
||||
oldest-supported-numpy
|
||||
numpy
|
||||
palettable
|
||||
pandas
|
||||
plotly
|
||||
pybtex
|
||||
pydispatcher
|
||||
requests
|
||||
ruamel-yaml
|
||||
scipy
|
||||
spglib
|
||||
sympy
|
||||
tabulate
|
||||
tqdm
|
||||
uncertainties
|
||||
];
|
||||
|
||||
optional-dependencies = {
|
||||
abinit = [ netcdf4 ];
|
||||
ase = [ ase ];
|
||||
joblib = [ joblib ];
|
||||
seekpath = [ seekpath ];
|
||||
ci = [
|
||||
pytest
|
||||
pytest-cov
|
||||
# pytest-split
|
||||
];
|
||||
docs = [
|
||||
invoke
|
||||
sphinx
|
||||
# sphinx_markdown_builder
|
||||
sphinx-rtd-theme
|
||||
];
|
||||
electronic_structure = [
|
||||
# fdint
|
||||
];
|
||||
mlp = [
|
||||
# chgnet
|
||||
# matgl
|
||||
];
|
||||
numba = [ numba ];
|
||||
vis = [ vtk ];
|
||||
};
|
||||
|
||||
pythonImportsCheck = [ "pymatgen" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
addBinToPathHook
|
||||
pytestCheckHook
|
||||
pytest-xdist
|
||||
] ++ lib.flatten (builtins.attrValues optional-dependencies);
|
||||
|
||||
preCheck = ''
|
||||
preCheck =
|
||||
# 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
|
||||
'';
|
||||
''
|
||||
export PMG_TEST_FILES_DIR="$(realpath ./tests/files)"
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "pymatgen" ];
|
||||
disabledTests =
|
||||
[
|
||||
# Flaky
|
||||
"test_numerical_eos_values"
|
||||
"test_pca"
|
||||
"test_static_si_no_kgrid"
|
||||
"test_thermal_conductivity"
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
|
||||
# AttributeError: 'NoneType' object has no attribute 'items'
|
||||
"test_mean_field"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# Fatal Python error: Aborted
|
||||
# matplotlib/backend_bases.py", line 2654 in create_with_canvas
|
||||
"test_angle"
|
||||
"test_as_dict_from_dict"
|
||||
"test_attributes"
|
||||
"test_basic"
|
||||
"test_core_state_eigen"
|
||||
"test_eos_func"
|
||||
"test_get_info_cohps_to_neighbors"
|
||||
"test_get_plot"
|
||||
"test_get_point_group_operations"
|
||||
"test_matplotlib_plots"
|
||||
"test_ph_plot_w_gruneisen"
|
||||
"test_plot"
|
||||
"test_proj_bandstructure_plot"
|
||||
"test_structure"
|
||||
"test_structure_environments"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# Crash when running the pmg command
|
||||
# Critical error: required built-in appearance SystemAppearance not found
|
||||
"tests/cli/test_pmg_plot.py"
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Robust materials analysis code that defines core object representations for structures and molecules";
|
||||
homepage = "https://pymatgen.org/";
|
||||
changelog = "https://github.com/materialsproject/pymatgen/releases/tag/${src.tag}";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ psyanticy ];
|
||||
changelog = "https://github.com/materialsproject/pymatgen/releases/tag/v${version}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ psyanticy ];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user