summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/monty/default.nix
blob: 1ee9626ab6e546f00aa7f6a512152d22a11aee6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,

  # 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 {
  pname = "monty";
  version = "2025.3.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "materialsvirtuallab";
    repo = "monty";
    tag = "v${version}";
    hash = "sha256-3UoACKJtPm2BrkJP8z7BFrh3baRyL/S3VwCG3K8AQn0=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    msgpack
    ruamel-yaml
  ];

  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" ];

  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
      standard library. Examples include useful utilities like transparent support for zipped files, useful design
      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 = lib.licenses.mit;
    maintainers = with lib.maintainers; [ psyanticy ];
  };
}