Files
nixpkgs/pkgs/development/python-modules/gymnasium/default.nix
T
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

89 lines
2.1 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
numpy,
cloudpickle,
gym-notices,
jax-jumpy,
typing-extensions,
farama-notifications,
importlib-metadata,
pythonOlder,
ffmpeg,
jax,
jaxlib,
matplotlib,
moviepy,
opencv4,
pybox2d,
pygame,
pytestCheckHook,
scipy,
stdenv,
}:
buildPythonPackage rec {
pname = "gymnasium";
version = "0.29.1";
format = "pyproject";
src = fetchFromGitHub {
owner = "Farama-Foundation";
repo = "gymnasium";
rev = "refs/tags/v${version}";
hash = "sha256-L7fn9FaJzXwQhjDKwI9hlFpbPuQdwynU+Xjd8bbjxiw=";
};
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
cloudpickle
farama-notifications
gym-notices
jax-jumpy
numpy
typing-extensions
] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
pythonImportsCheck = [ "gymnasium" ];
nativeCheckInputs = [
ffmpeg
jax
jaxlib
matplotlib
moviepy
opencv4
pybox2d
pygame
pytestCheckHook
scipy
];
# if `doCheck = true` on Darwin, `jaxlib` is evaluated, which is both
# marked as broken and throws an error during evaluation if the package is evaluated anyway.
# disabling checks on Darwin avoids this and allows the package to be built.
# if jaxlib is ever fixed on Darwin, remove this.
doCheck = !stdenv.hostPlatform.isDarwin;
disabledTestPaths = [
# mujoco is required for those tests but the mujoco python bindings are not packaged in nixpkgs.
"tests/envs/mujoco/test_mujoco_custom_env.py"
# Those tests need to write on the filesystem which cause them to fail.
"tests/experimental/wrappers/test_record_video.py"
"tests/utils/test_save_video.py"
"tests/wrappers/test_record_video.py"
"tests/wrappers/test_video_recorder.py"
];
meta = with lib; {
description = "Standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)";
homepage = "https://github.com/Farama-Foundation/Gymnasium";
license = licenses.mit;
maintainers = with maintainers; [ GaetanLepage ];
};
}