1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 msgpack,
6 numpy,
7 pandas,
8 pydantic,
9 pymongo,
10 pytestCheckHook,
11 pythonOlder,
12 ruamel-yaml,
13 setuptools,
14 setuptools-scm,
15 torch,
16 tqdm,
17}:
18
19buildPythonPackage rec {
20 pname = "monty";
21 version = "2024.4.17";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "materialsvirtuallab";
28 repo = "monty";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-UqpRkw6F8RAvchq0HBSfdHHO8Lgg+yLdBku+wsPKg0E=";
31 };
32
33 postPatch = ''
34 substituteInPlace tests/test_os.py \
35 --replace 'self.assertEqual("/usr/bin/find", which("/usr/bin/find"))' '#'
36 '';
37
38 nativeBuildInputs = [
39 setuptools
40 setuptools-scm
41 ];
42
43 propagatedBuildInputs = [
44 msgpack
45 ruamel-yaml
46 tqdm
47 ];
48
49 nativeCheckInputs = [
50 numpy
51 pandas
52 pydantic
53 pymongo
54 pytestCheckHook
55 torch
56 ];
57
58 pythonImportsCheck = [ "monty" ];
59
60 disabledTests = [
61 # Test file was removed and re-added after 2022.9.9
62 "test_reverse_readfile_gz"
63 "test_Path_objects"
64 "test_zopen"
65 "test_zpath"
66 ];
67
68 meta = with lib; {
69 description = "Serves as a complement to the Python standard library by providing a suite of tools to solve many common problems";
70 longDescription = "
71 Monty implements supplementary useful functions for Python that are not part of the
72 standard library. Examples include useful utilities like transparent support for zipped files, useful design
73 patterns such as singleton and cached_class, and many more.
74 ";
75 homepage = "https://github.com/materialsvirtuallab/monty";
76 changelog = "https://github.com/materialsvirtuallab/monty/releases/tag/v${version}";
77 license = licenses.mit;
78 maintainers = with maintainers; [ psyanticy ];
79 };
80}