From 555d7ca7db059977b7a8150a8950752a2cdaeead Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 26 Mar 2025 12:36:00 +0100 Subject: [PATCH] python3Packages.brax: init at 0.12.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GaƩtan Lepage <33058747+GaetanLepage@users.noreply.github.com> --- .../python-modules/brax/default.nix | 113 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 115 insertions(+) create mode 100644 pkgs/development/python-modules/brax/default.nix diff --git a/pkgs/development/python-modules/brax/default.nix b/pkgs/development/python-modules/brax/default.nix new file mode 100644 index 000000000000..5610ee08f322 --- /dev/null +++ b/pkgs/development/python-modules/brax/default.nix @@ -0,0 +1,113 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + stdenv, + + # build-system + setuptools, + + # dependencies + absl-py, + dm-env, + etils, + flask, + flask-cors, + flax, + grpcio, + gym, + jax, + jaxlib, + jaxopt, + jinja2, + ml-collections, + mujoco, + mujoco-mjx, + numpy, + optax, + orbax-checkpoint, + pillow, + pytinyrenderer, + scipy, + tensorboardx, + trimesh, + + # tests + pytestCheckHook, + pytest-xdist, + transforms3d, +}: + +buildPythonPackage rec { + pname = "brax"; + version = "0.12.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "google"; + repo = "brax"; + tag = "v${version}"; + hash = "sha256-whkkqTTy5CY6soyS5D7hWtBZuVHc6si1ArqwLgzHDkw="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + absl-py + # TODO: remove dm_env after dropping legacy v1 code + dm-env + etils + flask + flask-cors + flax + # TODO: remove grpcio and gym after dropping legacy v1 code + grpcio + gym + jax + jaxlib + jaxopt + jinja2 + ml-collections + mujoco + mujoco-mjx + numpy + optax + orbax-checkpoint + pillow + # TODO: remove pytinyrenderer after dropping legacy v1 code + pytinyrenderer + scipy + tensorboardx + trimesh + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-xdist + transforms3d + ]; + + disabledTests = lib.optionals stdenv.hostPlatform.isAarch64 [ + # Flaky: + # AssertionError: Array(-0.00135638, dtype=float32) != 0.0 within 0.001 delta (Array(0.00135638, dtype=float32) difference) + "test_pendulum_period2" + ]; + + disabledTestPaths = [ + # ValueError: matmul: Input operand 1 has a mismatch in its core dimension + "brax/generalized/constraint_test.py" + ]; + + pythonImportsCheck = [ + "brax" + ]; + + meta = { + description = "Massively parallel rigidbody physics simulation on accelerator hardware"; + homepage = "https://github.com/google/brax"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ nim65s ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 704825453925..d09c74ea223f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2010,6 +2010,8 @@ self: super: with self; { bravia-tv = callPackage ../development/python-modules/bravia-tv { }; + brax = callPackage ../development/python-modules/brax { }; + breathe = callPackage ../development/python-modules/breathe { }; breezy = callPackage ../development/python-modules/breezy { };