Skip to content

Commit

Permalink
Remove support for Python 3.6 (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts authored Oct 25, 2022
1 parent 71485ec commit 6b6d131
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- run: |
Expand Down
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1 # pick a git hash / tag to point to
rev: 6.1.1
hooks:
- id: pydocstyle
exclude: ^(gymnasium/envs/)|(tests/)|(docs/)
Expand All @@ -40,8 +40,7 @@ repos:
rev: v2.32.0
hooks:
- id: pyupgrade
# TODO: remove `--keep-runtime-typing` option
args: ["--py36-plus", "--keep-runtime-typing"]
args: ["--py37-plus"]
- repo: local
hooks:
- id: pyright
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For Atari envs, add a Markdown file into `pages/environments/atari` then complet

#### Non-Atari env

Ensure the environment is in Gymnasium (or your fork). Ensure that the environment's Python file has a properly formatted markdown docstring. Pip install Gymnasium (or your fork) then run `docs/scripts/gen_mds.py`. This will automatically generate an md page for the environment. Then complete the [other steps](#other-steps).
Ensure the environment is in Gymnasium (or your fork). Ensure that the environment's Python file has a properly formatted markdown docstring. Pip install Gymnasium (or your fork) then run `docs/scripts/gen_mds.py`. This will automatically generate a md page for the environment. Then complete the [other steps](#other-steps).

#### Other steps

Expand Down
7 changes: 0 additions & 7 deletions gymnasium/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Core API for Environment, Wrapper, ActionWrapper, RewardWrapper and ObservationWrapper."""
import sys
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -16,17 +15,11 @@
import numpy as np

from gymnasium import spaces
from gymnasium.logger import warn
from gymnasium.utils import seeding

if TYPE_CHECKING:
from gymnasium.envs.registration import EnvSpec

if sys.version_info[0:2] == (3, 6):
warn(
"Gymnasium minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+"
)

ObsType = TypeVar("ObsType")
ActType = TypeVar("ActType")
RenderFrame = TypeVar("RenderFrame")
Expand Down
5 changes: 1 addition & 4 deletions gymnasium/wrappers/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@

if sys.version_info >= (3, 8):
from typing import Protocol, runtime_checkable
elif sys.version_info >= (3, 7):
from typing_extensions import Protocol, runtime_checkable
else:
Protocol = object
runtime_checkable = lambda x: x # noqa: E731
from typing_extensions import Protocol, runtime_checkable


@runtime_checkable
Expand Down
2 changes: 1 addition & 1 deletion py.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin"
COPY . /usr/local/gymnasium/
WORKDIR /usr/local/gymnasium/

RUN if [ "python:${PYTHON_VERSION}" = "python:3.6.15" ] ; then pip install .[box2d,classic_control,toy_text,other] pytest=="7.0.1" --no-cache-dir; else pip install .[testing] --no-cache-dir; fi
RUN pip install .[testing] --no-cache-dir

ENTRYPOINT ["/usr/local/gymnasium/bin/docker_entrypoint"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ strict = [
]

typeCheckingMode = "basic"
pythonVersion = "3.6"
pythonVersion = "3.7"
pythonPlatform = "All"
typeshedPath = "typeshed"
enableTypeIgnoreComments = true
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ matplotlib>=3.0
box2d-py==2.3.5
pygame==2.1.0
ale-py~=0.8.0
mujoco==2.2.0
mujoco==2.2
mujoco_py<2.2,>=2.1
imageio>=2.14.1
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_version():
testing_group = set(extras.keys()) - {"accept-rom-license", "atari"}
extras["testing"] = list(
set(itertools.chain.from_iterable(map(lambda group: extras[group], testing_group)))
) + ["pytest==7.0.1", "gym==0.26.2"]
) + ["pytest==7.1.3", "gym==0.26.2"]

# All dependency groups - accept rom license as requires user to run
all_groups = set(extras.keys()) - {"accept-rom-license"}
Expand All @@ -70,7 +70,7 @@ def get_version():
long_description=long_description,
long_description_content_type="text/markdown",
keywords=["Reinforcement Learning", "game", "RL", "AI", "gymnasium"],
python_requires=">=3.6",
python_requires=">=3.7",
tests_require=extras["testing"],
packages=[
package for package in find_packages() if package.startswith("gymnasium")
Expand All @@ -90,12 +90,9 @@ def get_version():
"cloudpickle >= 1.2.0",
"importlib_metadata >= 4.8.0; python_version < '3.10'",
"gymnasium_notices >= 0.0.1",
"dataclasses == 0.8; python_version == '3.6'",
],
classifiers=[
# Python 3.6 is minimally supported (only with basic gymnasium environments and API)
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ matplotlib>=3.0
imageio>=2.14.1
pygame==2.1.0
mujoco_py<2.2,>=2.1
pytest==7.0.1
pytest==7.1.3
gym==0.26.2
5 changes: 1 addition & 4 deletions tests/envs/test_compatibility.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import Any, Dict, Optional, Tuple

import numpy as np
Expand Down Expand Up @@ -81,9 +80,7 @@ def test_explicit():

def test_implicit():
old_env = LegacyEnvImplicit()
if sys.version_info >= (3, 7):
# We need to give up on typing in Python 3.6
assert isinstance(old_env, LegacyEnv)
assert isinstance(old_env, LegacyEnv)
env = EnvCompatibility(old_env, render_mode="rgb_array")
assert env.observation_space == Discrete(1)
assert env.action_space == Discrete(1)
Expand Down

0 comments on commit 6b6d131

Please sign in to comment.