Gaetan Lepage 2025-04-26 13:20:48 +02:00
parent a9fb8169f5
commit ef6d77c86d

View File

@ -9,10 +9,10 @@
ninja, ninja,
pybind11, pybind11,
setuptools, setuptools,
wheel,
# buildInputs # buildInputs
SDL2, SDL2,
opencv,
zlib, zlib,
# dependencies # dependencies
@ -22,19 +22,25 @@
# tests # tests
gymnasium, gymnasium,
opencv-python,
pytestCheckHook, pytestCheckHook,
# Whether to enable recently added vector environments:
# https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.11.0/docs/vector-environment.md
# FIXME: Disabled by default as it mysteriously causes stable-baselines3's tests to hang indefinitely.
withVectorEnv ? false,
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "ale-py"; pname = "ale-py";
version = "0.10.2"; version = "0.11.0";
pyproject = true; pyproject = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "Farama-Foundation"; owner = "Farama-Foundation";
repo = "Arcade-Learning-Environment"; repo = "Arcade-Learning-Environment";
tag = "v${version}"; tag = "v${version}";
hash = "sha256-CGUlQFQoQZqs+Jd3IU/o50VwX+tEHrs3KHrcVWahEpo="; hash = "sha256-RgFVpbjJp54FncQzFtdZM7p/1GBMsQ2HvLgIoaokiQc=";
}; };
build-system = [ build-system = [
@ -42,15 +48,19 @@ buildPythonPackage rec {
ninja ninja
pybind11 pybind11
setuptools setuptools
wheel
]; ];
buildInputs = [ buildInputs =
SDL2 [
zlib SDL2
]; zlib
]
++ lib.optionals withVectorEnv [
opencv
];
dependencies = [ dependencies = [
gymnasium
importlib-resources importlib-resources
numpy numpy
typing-extensions typing-extensions
@ -60,17 +70,31 @@ buildPythonPackage rec {
# Relax the pybind11 version # Relax the pybind11 version
'' ''
substituteInPlace src/ale/python/CMakeLists.txt \ substituteInPlace src/ale/python/CMakeLists.txt \
--replace-fail 'find_package(pybind11 ''${PYBIND11_VER} QUIET)' 'find_package(pybind11 QUIET)' --replace-fail \
'find_package(pybind11 ''${PYBIND11_VER} QUIET)' \
'find_package(pybind11 QUIET)'
''
+ lib.optionalString (!withVectorEnv) ''
substituteInPlace setup.py \
--replace-fail \
"-DBUILD_VECTOR_LIB=ON" \
"-DBUILD_VECTOR_LIB=OFF"
''; '';
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
pythonImportsCheck = [ "ale_py" ]; pythonImportsCheck = [ "ale_py" ];
nativeCheckInputs = [ doCheck = false;
gymnasium
pytestCheckHook nativeCheckInputs =
]; [
gymnasium
pytestCheckHook
]
+ lib.optionals withVectorEnv [
opencv-python
];
disabledTests = [ disabledTests = [
# Fatal Python error: Aborted # Fatal Python error: Aborted
@ -81,6 +105,8 @@ buildPythonPackage rec {
# The user is expected to manually download the roms: # The user is expected to manually download the roms:
# https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.9.0/docs/faq.md#i-downloaded-ale-and-i-installed-it-successfully-but-i-cannot-find-any-rom-file-at-roms-do-i-have-to-get-them-somewhere-else # https://github.com/Farama-Foundation/Arcade-Learning-Environment/blob/v0.9.0/docs/faq.md#i-downloaded-ale-and-i-installed-it-successfully-but-i-cannot-find-any-rom-file-at-roms-do-i-have-to-get-them-somewhere-else
"test_check_env" "test_check_env"
"test_reset_step_shapes"
"test_rollout_consistency"
"test_sound_obs" "test_sound_obs"
]; ];
@ -92,7 +118,8 @@ buildPythonPackage rec {
license = lib.licenses.gpl2; license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ billhuang ]; maintainers = with lib.maintainers; [ billhuang ];
badPlatforms = [ badPlatforms = [
# fails to link with missing library # FAILED: src/ale/libale.a
# /bin/sh: CMAKE_CXX_COMPILER_AR-NOTFOUND: command not found
lib.systems.inspect.patterns.isDarwin lib.systems.inspect.patterns.isDarwin
]; ];
}; };