Commit d2d3838c authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python312Packages.monty: cleanup & add missing test dependency

parent 090f0c26
Loading
Loading
Loading
Loading
+67 −31
Original line number Diff line number Diff line
@@ -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 ];
  };
}