python312Packages.gymnasium: 0.29.1 -> 1.0.0 (#313379)

This commit is contained in:
Samuel Ainsworth 2024-10-25 15:32:54 -04:00 committed by GitHub
commit f2a2246d50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 67 additions and 39 deletions

View File

@ -1,48 +1,53 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
numpy,
# dependencies
cloudpickle,
gym-notices,
jax-jumpy,
typing-extensions,
farama-notifications,
importlib-metadata,
numpy,
typing-extensions,
pythonOlder,
ffmpeg,
importlib-metadata,
# tests
dill,
flax,
jax,
jaxlib,
matplotlib,
mujoco,
moviepy,
opencv4,
pybox2d,
pygame,
pytestCheckHook,
scipy,
stdenv,
}:
buildPythonPackage rec {
pname = "gymnasium";
version = "0.29.1";
format = "pyproject";
version = "1.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "Farama-Foundation";
repo = "gymnasium";
rev = "refs/tags/v${version}";
hash = "sha256-L7fn9FaJzXwQhjDKwI9hlFpbPuQdwynU+Xjd8bbjxiw=";
hash = "sha256-Qchuz08yJ0giVrtKLC9vBgr28JrHQyAOCuoS239ivVw=";
};
nativeBuildInputs = [ setuptools ];
build-system = [ setuptools ];
propagatedBuildInputs = [
dependencies = [
cloudpickle
farama-notifications
gym-notices
jax-jumpy
numpy
typing-extensions
] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
@ -50,11 +55,13 @@ buildPythonPackage rec {
pythonImportsCheck = [ "gymnasium" ];
nativeCheckInputs = [
ffmpeg
dill
flax
jax
jaxlib
matplotlib
moviepy
mujoco
opencv4
pybox2d
pygame
@ -69,20 +76,30 @@ buildPythonPackage rec {
doCheck = !stdenv.hostPlatform.isDarwin;
disabledTestPaths = [
# mujoco is required for those tests but the mujoco python bindings are not packaged in nixpkgs.
# Unpackaged `mujoco-py` (Openai's mujoco) is required for these tests.
"tests/envs/mujoco/test_mujoco_custom_env.py"
"tests/envs/mujoco/test_mujoco_rendering.py"
"tests/envs/mujoco/test_mujoco_v5.py"
# Those tests need to write on the filesystem which cause them to fail.
"tests/experimental/wrappers/test_record_video.py"
# Rendering tests failing in the sandbox
"tests/wrappers/vector/test_human_rendering.py"
# These tests need to write on the filesystem which cause them to fail.
"tests/utils/test_save_video.py"
"tests/wrappers/test_record_video.py"
"tests/wrappers/test_video_recorder.py"
];
meta = with lib; {
disabledTests = [
# Succeeds for most environments but `test_render_modes[Reacher-v4]` fails because it requires
# OpenGL access which is not possible inside the sandbox.
"test_render_mode"
];
meta = {
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 ];
changelog = "https://github.com/Farama-Foundation/Gymnasium/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}

View File

@ -1,12 +1,17 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
fetchpatch,
# build-system
setuptools,
wheel,
# dependencies
gymnasium,
numpy,
# tests
ale-py,
bsuite,
dm-control,
@ -18,21 +23,32 @@
buildPythonPackage rec {
pname = "shimmy";
version = "1.3.0";
version = "2.0.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "Farama-Foundation";
repo = "Shimmy";
rev = "refs/tags/v${version}";
hash = "sha256-rYBbGyMSFF/iIGruKn2JXKAVIZIfJDEHUEZUESiUg/k=";
hash = "sha256-/wIXjOGb3UeMQdeifYagd7OcxbBcdGPS09mjvkFsWmk=";
};
patches = [
# Shimmy tries to register some environments from `dm-control` that require unpackaged `labmaze`.
# This prevents from importing `shimmy` itself by crashing with a `ModuleNotFoundError`.
# This patch imports those environments lazily.
#
# TODO: get rid of this patch at the next release as the issue has been fixed upstream:
# https://github.com/Farama-Foundation/Shimmy/pull/125
(fetchpatch {
name = "prevent-labmaze-import-crash";
url = "https://github.com/Farama-Foundation/Shimmy/commit/095d576f6aae15a09a1e426138629ce9f43a3c04.patch";
hash = "sha256-rr9l3tHunYFk0j7hfo9IaSRlogAtwXoXcQ0zuU/TL8c=";
})
];
build-system = [
setuptools
wheel
];
dependencies = [
@ -58,10 +74,6 @@ buildPythonPackage rec {
# Requires unpackaged pyspiel
"tests/test_openspiel.py"
# Broken since ale-py v0.9.0 due to API change
# https://github.com/Farama-Foundation/Shimmy/issues/120
"tests/test_atari.py"
];
preCheck = ''

View File

@ -1,7 +1,6 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
# build-system
@ -44,8 +43,6 @@
pytestCheckHook,
pyyaml,
scipy,
stdenv,
}:
buildPythonPackage rec {
@ -53,8 +50,6 @@ buildPythonPackage rec {
version = "0.5.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "pytorch";
repo = "rl";
@ -138,6 +133,11 @@ buildPythonPackage rec {
++ optional-dependencies.rendering;
disabledTests = [
# torchrl is incompatible with gymnasium>=1.0
# https://github.com/pytorch/rl/discussions/2483
"test_resetting_strategies"
"test_torchrl_to_gym"
# mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called
"test_vecenvs_env"
@ -175,6 +175,5 @@ buildPythonPackage rec {
changelog = "https://github.com/pytorch/rl/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
# ~3k tests fail with: RuntimeError: internal error
};
}