1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9 setuptools-scm,
10
11 # dependencies
12 msgpack,
13 ruamel-yaml,
14
15 # optional-dependencies
16 coverage,
17 pymongo,
18 pytest,
19 pytest-cov,
20 types-requests,
21 sphinx,
22 sphinx-rtd-theme,
23 orjson,
24 pandas,
25 pydantic,
26 pint,
27 torch,
28 tqdm,
29 invoke,
30 requests,
31
32 # tests
33 ipython,
34 numpy,
35 pytestCheckHook,
36}:
37
38buildPythonPackage rec {
39 pname = "monty";
40 version = "2025.3.3";
41 pyproject = true;
42
43 src = fetchFromGitHub {
44 owner = "materialsvirtuallab";
45 repo = "monty";
46 tag = "v${version}";
47 hash = "sha256-3UoACKJtPm2BrkJP8z7BFrh3baRyL/S3VwCG3K8AQn0=";
48 };
49
50 build-system = [
51 setuptools
52 setuptools-scm
53 ];
54
55 dependencies = [
56 msgpack
57 ruamel-yaml
58 ];
59
60 optional-dependencies = rec {
61 ci = [
62 coverage
63 pymongo
64 pytest
65 pytest-cov
66 types-requests
67 ]
68 ++ optional;
69 dev = [ ipython ];
70 docs = [
71 sphinx
72 sphinx-rtd-theme
73 ];
74 json = [
75 orjson
76 pandas
77 pydantic
78 pymongo
79 ]
80 ++ lib.optionals (pythonOlder "3.13") [
81 pint
82 torch
83 ];
84 multiprocessing = [ tqdm ];
85 optional = dev ++ json ++ multiprocessing ++ serialization;
86 serialization = [ msgpack ];
87 task = [
88 invoke
89 requests
90 ];
91 };
92
93 nativeCheckInputs = [
94 ipython
95 numpy
96 pandas
97 pydantic
98 pymongo
99 pytestCheckHook
100 torch
101 tqdm
102 ];
103
104 pythonImportsCheck = [ "monty" ];
105
106 meta = {
107 description = "Serves as a complement to the Python standard library by providing a suite of tools to solve many common problems";
108 longDescription = "
109 Monty implements supplementary useful functions for Python that are not part of the
110 standard library. Examples include useful utilities like transparent support for zipped files, useful design
111 patterns such as singleton and cached_class, and many more.
112 ";
113 homepage = "https://github.com/materialsvirtuallab/monty";
114 changelog = "https://github.com/materialsvirtuallab/monty/releases/tag/${src.tag}";
115 license = lib.licenses.mit;
116 maintainers = with lib.maintainers; [ psyanticy ];
117 };
118}