From 004543ac8141bf295d7fb47cad4e77da5a5c918d Mon Sep 17 00:00:00 2001 From: Kallinteris Andreas <30759571+Kallinteris-Andreas@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:28:18 +0300 Subject: [PATCH] drop `python 3.7` support (#573) --- .github/workflows/build-publish.yml | 3 --- .github/workflows/build.yml | 2 +- .pre-commit-config.yaml | 2 +- README.md | 2 +- gymnasium/envs/registration.py | 5 +---- gymnasium/experimental/wrappers/lambda_observation.py | 3 +-- gymnasium/experimental/wrappers/stateful_observation.py | 3 +-- gymnasium/wrappers/compatibility.py | 9 +-------- pyproject.toml | 3 +-- 9 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index dd96506d0..e6063eae6 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -20,9 +20,6 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - python: 37 - platform: manylinux_x86_64 - os: ubuntu-latest python: 38 platform: manylinux_x86_64 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79bdb120d..ffc47700c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 - run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d83b6030..9dd1847e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: rev: v3.3.2 hooks: - id: pyupgrade - args: ["--py37-plus"] + args: ["--py38-plus"] - repo: https://github.com/PyCQA/isort rev: 5.12.0 hooks: diff --git a/README.md b/README.md index 5cb60586b..f5d620863 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ To install the base Gymnasium library, use `pip install gymnasium` This does not include dependencies for all families of environments (there's a massive number, and some can be problematic to install on certain systems). You can install these dependencies for one family like `pip install "gymnasium[atari]"` or use `pip install "gymnasium[all]"` to install all dependencies. -We support and test for Python 3.7, 3.8, 3.9, 3.10, 3.11 on Linux and macOS. We will accept PRs related to Windows, but do not officially support it. +We support and test for Python 3.8, 3.9, 3.10, 3.11 on Linux and macOS. We will accept PRs related to Windows, but do not officially support it. ## API diff --git a/gymnasium/envs/registration.py b/gymnasium/envs/registration.py index c5c1c5ae8..52a89991c 100644 --- a/gymnasium/envs/registration.py +++ b/gymnasium/envs/registration.py @@ -24,10 +24,7 @@ else: import importlib.metadata as metadata -if sys.version_info < (3, 8): - from typing_extensions import Protocol -else: - from typing import Protocol +from typing import Protocol ENV_ID_RE = re.compile( diff --git a/gymnasium/experimental/wrappers/lambda_observation.py b/gymnasium/experimental/wrappers/lambda_observation.py index b7b563d22..36f0d70fc 100644 --- a/gymnasium/experimental/wrappers/lambda_observation.py +++ b/gymnasium/experimental/wrappers/lambda_observation.py @@ -12,8 +12,7 @@ """ from __future__ import annotations -from typing import Any, Callable, Sequence -from typing_extensions import Final +from typing import Any, Callable, Final, Sequence import numpy as np diff --git a/gymnasium/experimental/wrappers/stateful_observation.py b/gymnasium/experimental/wrappers/stateful_observation.py index 331c07fa3..abcd5f7a7 100644 --- a/gymnasium/experimental/wrappers/stateful_observation.py +++ b/gymnasium/experimental/wrappers/stateful_observation.py @@ -10,8 +10,7 @@ from collections import deque from copy import deepcopy -from typing import Any, SupportsFloat -from typing_extensions import Final +from typing import Any, Final, SupportsFloat import numpy as np diff --git a/gymnasium/wrappers/compatibility.py b/gymnasium/wrappers/compatibility.py index 3f0b2cefd..9eefdb034 100644 --- a/gymnasium/wrappers/compatibility.py +++ b/gymnasium/wrappers/compatibility.py @@ -1,6 +1,5 @@ """A compatibility wrapper converting an old-style environment into a valid environment.""" -import sys -from typing import Any, Dict, Optional, Tuple +from typing import Any, Dict, Optional, Protocol, Tuple, runtime_checkable import gymnasium as gym from gymnasium import logger @@ -10,12 +9,6 @@ ) -if sys.version_info >= (3, 8): - from typing import Protocol, runtime_checkable -else: - from typing_extensions import Protocol, runtime_checkable - - @runtime_checkable class LegacyEnv(Protocol): """A protocol for environments using the old step API.""" diff --git a/pyproject.toml b/pyproject.toml index 9ee15a701..8569a3b7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" name = "gymnasium" description = "A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)." readme = "README.md" -requires-python = ">= 3.7" +requires-python = ">= 3.8" authors = [{ name = "Farama Foundation", email = "contact@farama.org" }] license = { text = "MIT License" } keywords = ["Reinforcement Learning", "game", "RL", "AI", "gymnasium"] @@ -16,7 +16,6 @@ classifiers = [ "Development Status :: 4 - Beta", # change to `5 - Production/Stable` when ready "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10",