about summary refs log tree commit diff
path: root/pkgs/development/python-modules/optree/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/optree/default.nix')
-rw-r--r--pkgs/development/python-modules/optree/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/optree/default.nix b/pkgs/development/python-modules/optree/default.nix
new file mode 100644
index 000000000000..a9eb9d9a3626
--- /dev/null
+++ b/pkgs/development/python-modules/optree/default.nix
@@ -0,0 +1,54 @@
+{
+  buildPythonPackage,
+  fetchFromGitHub,
+  pythonOlder,
+  lib,
+  cmake,
+  setuptools,
+  typing-extensions,
+  pybind11,
+  pytestCheckHook,
+}:
+
+buildPythonPackage rec {
+  pname = "optree";
+  version = "0.13.0";
+  pyproject = true;
+
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "metaopt";
+    repo = "optree";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-HuzfQ1arAF/DbJd9MF0jAxfzWvOHtAfkEMUF+aPfaII=";
+  };
+
+  dontUseCmakeConfigure = true;
+
+  propagatedBuildInputs = [ typing-extensions ];
+  nativeBuildInputs = [
+    setuptools
+    pybind11
+    cmake
+  ];
+
+  nativeCheckInputs = [ pytestCheckHook ];
+  # prevent import failures from pytest
+  preCheck = ''
+    rm -r optree
+  '';
+  disabledTests = [
+    # Fails because the 'test_treespec' module can't be found
+    "test_treespec_pickle_missing_registration"
+  ];
+  pythonImportsCheck = [ "optree" ];
+
+  meta = {
+    description = "Optimized PyTree Utilities";
+    homepage = "https://github.com/metaopt/optree";
+    changelog = "https://github.com/metaopt/optree/releases";
+    license = lib.licenses.asl20;
+    maintainers = with lib.maintainers; [ pandapip1 ];
+  };
+}