From a5f7429ef095b403eac47eae94efd57ed16d5cbe Mon Sep 17 00:00:00 2001 From: Alexander Tsvyashchenko Date: Thu, 30 Dec 2021 18:17:35 +0100 Subject: [PATCH] python3Packages.treex: init at 0.6.7 --- .../python-modules/treex/default.nix | 71 +++++++++++++++++++ .../python-modules/treex/relax-deps.patch | 13 ++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 86 insertions(+) create mode 100644 pkgs/development/python-modules/treex/default.nix create mode 100644 pkgs/development/python-modules/treex/relax-deps.patch diff --git a/pkgs/development/python-modules/treex/default.nix b/pkgs/development/python-modules/treex/default.nix new file mode 100644 index 000000000000..bdea03896cb5 --- /dev/null +++ b/pkgs/development/python-modules/treex/default.nix @@ -0,0 +1,71 @@ +{ buildPythonPackage +, cloudpickle +, dm-haiku +, einops +, fetchFromGitHub +, flax +, hypothesis +, keras +, lib +, poetry-core +, pytestCheckHook +, pyyaml +, rich +, tensorflow +, treeo +}: + +buildPythonPackage rec { + pname = "treex"; + version = "0.6.7"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "cgarciae"; + repo = pname; + rev = version; + sha256 = "1hl3wj71c7cp7jzkhyjy7xgs2vc8c89icq0bgfr49y4pwv69n43m"; + }; + + patches = [ + ./relax-deps.patch + ]; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + einops + flax + pyyaml + rich + treeo + ]; + + checkInputs = [ + cloudpickle + dm-haiku + hypothesis + keras + pytestCheckHook + tensorflow + ]; + + pythonImportsCheck = [ + "treex" + ]; + + disabledTestPaths = [ + # Require `torchmetrics` which is not packaged in `nixpkgs`. + "tests/metrics/test_mean_absolute_error.py" + "tests/metrics/test_mean_square_error.py" + ]; + + meta = with lib; { + description = "Pytree Module system for Deep Learning in JAX"; + homepage = "https://github.com/cgarciae/treex"; + license = licenses.mit; + maintainers = with maintainers; [ ndl ]; + }; +} diff --git a/pkgs/development/python-modules/treex/relax-deps.patch b/pkgs/development/python-modules/treex/relax-deps.patch new file mode 100644 index 000000000000..5b00082ba30c --- /dev/null +++ b/pkgs/development/python-modules/treex/relax-deps.patch @@ -0,0 +1,13 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 7b9ef68..ec11f32 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -18,7 +18,7 @@ python = "^3.7" + flax = "^0.3.4" + PyYAML = "^5.4.1" + rich = "^10.7.0" +-optax = "^0.0.9" ++optax = ">=0.0.9" + einops = "^0.3.2" + treeo = "^0.0.9" + # treeo = { path = "../treeo", develop = true } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6ab59cdf54a6..d6f550d791c8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9808,6 +9808,8 @@ in { treeo = callPackage ../development/python-modules/treeo { }; + treex = callPackage ../development/python-modules/treex { }; + treq = callPackage ../development/python-modules/treq { }; trezor_agent = callPackage ../development/python-modules/trezor_agent { };