Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Versioning] Add python 3.12 to setup.py #2282

Merged
merged 11 commits into from
Jul 28, 2024
Prev Previous commit
Next Next commit
amend
  • Loading branch information
vmoens committed Jul 11, 2024
commit 535e5e7fbad5fbe0cfbbf3f99a060cdec11e20a7
2 changes: 1 addition & 1 deletion .github/unittest/linux/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ conda deactivate
conda activate "${env_dir}"

echo "installing gymnasium"
pip3 install "gymnasium[ale-py,accept-rom-license]"
pip3 install "gymnasium"
pip3 install ale_py
pip3 install mo-gymnasium[mujoco] # requires here bc needs mujoco-py
pip3 install mujoco -U
Expand Down
26 changes: 22 additions & 4 deletions test/_utils_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ def PONG_VERSIONED():
return _PONG_VERSIONED


def BREAKOUT_VERSIONED():
# load gym
# Gymnasium says that the ale_py behaviour changes from 1.0
# but with python 3.12 it is already the case with 0.29.1
try:
import ale_py # noqa
except ImportError:
pass

if gym_backend() is not None:
_set_gym_environments()
return _BREAKOUT_VERSIONED


def PENDULUM_VERSIONED():
# load gym
if gym_backend() is not None:
Expand All @@ -76,42 +90,46 @@ def PENDULUM_VERSIONED():


def _set_gym_environments():
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED

_CARTPOLE_VERSIONED = None
_HALFCHEETAH_VERSIONED = None
_PENDULUM_VERSIONED = None
_PONG_VERSIONED = None
_BREAKOUT_VERSIONED = None


@implement_for("gym", None, "0.21.0")
def _set_gym_environments(): # noqa: F811
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED

_CARTPOLE_VERSIONED = "CartPole-v0"
_HALFCHEETAH_VERSIONED = "HalfCheetah-v2"
_PENDULUM_VERSIONED = "Pendulum-v0"
_PONG_VERSIONED = "Pong-v4"
_BREAKOUT_VERSIONED = "Breakout-v4"


@implement_for("gym", "0.21.0", None)
def _set_gym_environments(): # noqa: F811
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED

_CARTPOLE_VERSIONED = "CartPole-v1"
_HALFCHEETAH_VERSIONED = "HalfCheetah-v4"
_PENDULUM_VERSIONED = "Pendulum-v1"
_PONG_VERSIONED = "ALE/Pong-v5"
_BREAKOUT_VERSIONED = "ALE/Breakout-v5"


@implement_for("gymnasium")
def _set_gym_environments(): # noqa: F811
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED

_CARTPOLE_VERSIONED = "CartPole-v1"
_HALFCHEETAH_VERSIONED = "HalfCheetah-v4"
_PENDULUM_VERSIONED = "Pendulum-v1"
_PONG_VERSIONED = "ALE/Pong-v5"
_BREAKOUT_VERSIONED = "ALE/Breakout-v5"


if _has_gym:
Expand Down
Loading
Loading