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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/unittest/linux/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies:
- mlflow
- av
- coverage
- ray<2.8.0
- ray
- transformers
- ninja
- timm
3 changes: 2 additions & 1 deletion .github/unittest/linux/scripts/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ conda deactivate
conda activate "${env_dir}"

echo "installing gymnasium"
pip3 install "gymnasium[atari,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
2 changes: 1 addition & 1 deletion .github/unittest/linux_distributed/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ dependencies:
- mlflow
- av
- coverage
- ray<2.8.0
- ray
- virtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dependencies:
- dm_control -e git+https://github.com/deepmind/dm_control.git@c053360edea6170acfd9c8f65446703307d9d352#egg={dm_control}
- patchelf
- pyopengl==3.1.4
- ray<2.8.0
- ray
- av
2 changes: 1 addition & 1 deletion .github/unittest/linux_optdeps/scripts/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ dependencies:
- pyyaml
- scipy
- coverage
- ray<2.8.0
- ray
4 changes: 2 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
tests-cpu:
strategy:
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
tests-gpu:
strategy:
matrix:
python_version: ["3.10"]
python_version: ["3.11"]
cuda_arch_version: ["12.1"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def _main(argv):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
Expand Down
33 changes: 29 additions & 4 deletions test/_utils_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,32 @@ def HALFCHEETAH_VERSIONED():

def PONG_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 _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 @@ -69,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