Skip to content

Commit 935e8da

Browse files
author
Vincent Moens
authored
[Versioning] Add python 3.12 to setup.py (#2282)
1 parent 474e837 commit 935e8da

File tree

9 files changed

+370
-98
lines changed

9 files changed

+370
-98
lines changed

.github/unittest/linux/scripts/environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies:
2828
- mlflow
2929
- av
3030
- coverage
31-
- ray<2.8.0
31+
- ray
3232
- transformers
3333
- ninja
34+
- timm

.github/unittest/linux/scripts/run_all.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ conda deactivate
8888
conda activate "${env_dir}"
8989

9090
echo "installing gymnasium"
91-
pip3 install "gymnasium[atari,ale-py,accept-rom-license]"
91+
pip3 install "gymnasium"
92+
pip3 install ale_py
9293
pip3 install mo-gymnasium[mujoco] # requires here bc needs mujoco-py
9394
pip3 install mujoco -U
9495

.github/unittest/linux_distributed/scripts/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ dependencies:
2727
- mlflow
2828
- av
2929
- coverage
30-
- ray<2.8.0
30+
- ray
3131
- virtualenv

.github/unittest/linux_olddeps/scripts_gym_0_13/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ dependencies:
2424
- dm_control -e git+https://github.com/deepmind/dm_control.git@c053360edea6170acfd9c8f65446703307d9d352#egg={dm_control}
2525
- patchelf
2626
- pyopengl==3.1.4
27-
- ray<2.8.0
27+
- ray
2828
- av

.github/unittest/linux_optdeps/scripts/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ dependencies:
1717
- pyyaml
1818
- scipy
1919
- coverage
20-
- ray<2.8.0
20+
- ray

.github/workflows/test-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
tests-cpu:
2323
strategy:
2424
matrix:
25-
python_version: ["3.8", "3.9", "3.10", "3.11"]
25+
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2626
fail-fast: false
2727
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
2828
with:
@@ -51,7 +51,7 @@ jobs:
5151
tests-gpu:
5252
strategy:
5353
matrix:
54-
python_version: ["3.10"]
54+
python_version: ["3.11"]
5555
cuda_arch_version: ["12.1"]
5656
fail-fast: false
5757
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ def _main(argv):
274274
"Programming Language :: Python :: 3.9",
275275
"Programming Language :: Python :: 3.10",
276276
"Programming Language :: Python :: 3.11",
277+
"Programming Language :: Python :: 3.12",
277278
"License :: OSI Approved :: MIT License",
278279
"Operating System :: OS Independent",
279280
"Development Status :: 4 - Beta",

test/_utils_internal.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,32 @@ def HALFCHEETAH_VERSIONED():
5656

5757
def PONG_VERSIONED():
5858
# load gym
59+
# Gymnasium says that the ale_py behaviour changes from 1.0
60+
# but with python 3.12 it is already the case with 0.29.1
61+
try:
62+
import ale_py # noqa
63+
except ImportError:
64+
pass
65+
5966
if gym_backend() is not None:
6067
_set_gym_environments()
6168
return _PONG_VERSIONED
6269

6370

71+
def BREAKOUT_VERSIONED():
72+
# load gym
73+
# Gymnasium says that the ale_py behaviour changes from 1.0
74+
# but with python 3.12 it is already the case with 0.29.1
75+
try:
76+
import ale_py # noqa
77+
except ImportError:
78+
pass
79+
80+
if gym_backend() is not None:
81+
_set_gym_environments()
82+
return _BREAKOUT_VERSIONED
83+
84+
6485
def PENDULUM_VERSIONED():
6586
# load gym
6687
if gym_backend() is not None:
@@ -69,42 +90,46 @@ def PENDULUM_VERSIONED():
6990

7091

7192
def _set_gym_environments():
72-
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
93+
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED
7394

7495
_CARTPOLE_VERSIONED = None
7596
_HALFCHEETAH_VERSIONED = None
7697
_PENDULUM_VERSIONED = None
7798
_PONG_VERSIONED = None
99+
_BREAKOUT_VERSIONED = None
78100

79101

80102
@implement_for("gym", None, "0.21.0")
81103
def _set_gym_environments(): # noqa: F811
82-
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
104+
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED
83105

84106
_CARTPOLE_VERSIONED = "CartPole-v0"
85107
_HALFCHEETAH_VERSIONED = "HalfCheetah-v2"
86108
_PENDULUM_VERSIONED = "Pendulum-v0"
87109
_PONG_VERSIONED = "Pong-v4"
110+
_BREAKOUT_VERSIONED = "Breakout-v4"
88111

89112

90113
@implement_for("gym", "0.21.0", None)
91114
def _set_gym_environments(): # noqa: F811
92-
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
115+
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED
93116

94117
_CARTPOLE_VERSIONED = "CartPole-v1"
95118
_HALFCHEETAH_VERSIONED = "HalfCheetah-v4"
96119
_PENDULUM_VERSIONED = "Pendulum-v1"
97120
_PONG_VERSIONED = "ALE/Pong-v5"
121+
_BREAKOUT_VERSIONED = "ALE/Breakout-v5"
98122

99123

100124
@implement_for("gymnasium")
101125
def _set_gym_environments(): # noqa: F811
102-
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED
126+
global _CARTPOLE_VERSIONED, _HALFCHEETAH_VERSIONED, _PENDULUM_VERSIONED, _PONG_VERSIONED, _BREAKOUT_VERSIONED
103127

104128
_CARTPOLE_VERSIONED = "CartPole-v1"
105129
_HALFCHEETAH_VERSIONED = "HalfCheetah-v4"
106130
_PENDULUM_VERSIONED = "Pendulum-v1"
107131
_PONG_VERSIONED = "ALE/Pong-v5"
132+
_BREAKOUT_VERSIONED = "ALE/Breakout-v5"
108133

109134

110135
if _has_gym:

0 commit comments

Comments
 (0)