mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-07-31 13:54:31 +00:00
Rewrite setup (#2865)
* Updated testing requirements based off extra["testing"] * Updated setup to check the version is valid, added testing and all dependency groups and collects the requirements from requirements.txt to keep everything standardized. * Updated requirements.txt based on the current minimum gym requirements.txt to work * Updated requirements.txt based on the current minimum gym requirements.txt to work * Updated test_requirements.txt based on the current gym full testing requirements * Pre-commit updates * Add integer check for the `n` parameter * The type of self.spaces is an Iterable which is absorbed by the tuple. * Simplifies the environment checker to two files, env_checker.py and passive_env_checker.py with a new wrapper env_checker.py * Adds the passive environment checker on `gym.make` * Ignore the `check_env` warn parameter * Ignore the `check_env` warn parameter * Use the `data_equivalence` function * Remove env_checker PR changes * Move pip install pytest and mock to py 3.6 * Update setup.py and requirements.txt
This commit is contained in:
@@ -14,7 +14,6 @@ ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mujoco210/bin
|
|||||||
COPY . /usr/local/gym/
|
COPY . /usr/local/gym/
|
||||||
WORKDIR /usr/local/gym/
|
WORKDIR /usr/local/gym/
|
||||||
|
|
||||||
RUN if [ python:$PYTHON_VERSION = "python:3.6.15" ] ; then pip install .[box2d,classic_control,toy_text,other] ; else pip install .[noatari] ; fi
|
RUN if [ python:$PYTHON_VERSION = "python:3.6.15" ] ; then pip install .[box2d,classic_control,toy_text,other] pytest mock ; else pip install .[testing] ; fi
|
||||||
RUN pip install -r test_requirements.txt
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
|
ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
|
||||||
|
@@ -1,9 +1,14 @@
|
|||||||
ale-py~=0.7.5
|
|
||||||
opencv-python>=3.0
|
|
||||||
box2d-py==2.3.5
|
|
||||||
scipy>=1.4.1
|
|
||||||
numpy>=1.18.0
|
numpy>=1.18.0
|
||||||
pyglet>=1.4.0
|
|
||||||
cloudpickle>=1.2.0
|
cloudpickle>=1.2.0
|
||||||
|
importlib_metadata>=4.8.0; python_version < '3.10'
|
||||||
|
gym_notices>=0.0.4
|
||||||
|
dataclasses==0.8; python_version == '3.6'
|
||||||
|
opencv-python>=3.0
|
||||||
lz4>=3.1.0
|
lz4>=3.1.0
|
||||||
|
matplotlib>=3.0
|
||||||
|
box2d-py==2.3.5
|
||||||
pygame==2.1.0
|
pygame==2.1.0
|
||||||
|
ale-py~=0.7.5
|
||||||
|
mujoco==2.2.0
|
||||||
|
mujoco_py<2.2,>=2.1
|
||||||
|
imageio>=2.14.1
|
86
setup.py
86
setup.py
@@ -1,13 +1,15 @@
|
|||||||
"""Setups the project."""
|
"""Setups the project."""
|
||||||
import itertools
|
import itertools
|
||||||
import os.path
|
import re
|
||||||
import sys
|
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
# Don't import gym module here, since deps may not be installed
|
with open("gym/version.py") as file:
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "gym"))
|
full_version = file.read()
|
||||||
from version import VERSION # noqa:E402
|
assert (
|
||||||
|
re.match(r'VERSION = "\d\.\d+\.\d+"\n', full_version).group(0) == full_version
|
||||||
|
), f"Unexpected version: {full_version}"
|
||||||
|
VERSION = re.search(r"\d\.\d+\.\d+", full_version).group(0)
|
||||||
|
|
||||||
# Environment-specific dependencies.
|
# Environment-specific dependencies.
|
||||||
extras = {
|
extras = {
|
||||||
@@ -17,29 +19,20 @@ extras = {
|
|||||||
"classic_control": ["pygame==2.1.0"],
|
"classic_control": ["pygame==2.1.0"],
|
||||||
"mujoco_py": ["mujoco_py<2.2,>=2.1"],
|
"mujoco_py": ["mujoco_py<2.2,>=2.1"],
|
||||||
"mujoco": ["mujoco==2.2.0", "imageio>=2.14.1"],
|
"mujoco": ["mujoco==2.2.0", "imageio>=2.14.1"],
|
||||||
"toy_text": ["pygame==2.1.0", "scipy>=1.4.1"],
|
"toy_text": ["pygame==2.1.0"],
|
||||||
"other": ["lz4>=3.1.0", "opencv-python>=3.0", "matplotlib>=3.0"],
|
"other": ["lz4>=3.1.0", "opencv-python>=3.0", "matplotlib>=3.0"],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Meta dependency groups.
|
# Testing dependency groups.
|
||||||
nomujoco_blacklist = {"mujoco_py", "mujoco", "accept-rom-license", "atari"}
|
testing_group = set(extras.keys()) - {"accept-rom-license", "atari"}
|
||||||
nomujoco_groups = set(extras.keys()) - nomujoco_blacklist
|
extras["testing"] = list(
|
||||||
|
set(itertools.chain.from_iterable(map(lambda group: extras[group], testing_group)))
|
||||||
extras["nomujoco"] = list(
|
) + ["pytest", "mock"]
|
||||||
itertools.chain.from_iterable(map(lambda group: extras[group], nomujoco_groups))
|
|
||||||
)
|
|
||||||
|
|
||||||
noatari_blacklist = {"accept-rom-license", "atari"}
|
|
||||||
noatari_groups = set(extras.keys()) - noatari_blacklist
|
|
||||||
extras["noatari"] = list(
|
|
||||||
itertools.chain.from_iterable(map(lambda group: extras[group], noatari_groups))
|
|
||||||
)
|
|
||||||
|
|
||||||
all_blacklist = {"accept-rom-license"}
|
|
||||||
all_groups = set(extras.keys()) - all_blacklist
|
|
||||||
|
|
||||||
|
# All dependency groups - accept rom license as requires user to run
|
||||||
|
all_groups = set(extras.keys()) - {"accept-rom-license"}
|
||||||
extras["all"] = list(
|
extras["all"] = list(
|
||||||
itertools.chain.from_iterable(map(lambda group: extras[group], all_groups))
|
set(itertools.chain.from_iterable(map(lambda group: extras[group], all_groups)))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Uses the readme as the description on PyPI
|
# Uses the readme as the description on PyPI
|
||||||
@@ -55,25 +48,31 @@ with open("README.md") as fh:
|
|||||||
break
|
break
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="gym",
|
|
||||||
version=VERSION,
|
|
||||||
description="Gym: A universal API for reinforcement learning environments",
|
|
||||||
url="https://www.gymlibrary.ml/",
|
|
||||||
author="Gym Community",
|
author="Gym Community",
|
||||||
author_email="jkterry@umd.edu",
|
author_email="jkterry@umd.edu",
|
||||||
|
classifiers=[
|
||||||
|
# Python 3.6 is minimally supported (only with basic gym 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",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
],
|
||||||
|
description="Gym: A universal API for reinforcement learning environments",
|
||||||
|
extras_require=extras,
|
||||||
|
install_requires=[
|
||||||
|
"numpy >= 1.18.0",
|
||||||
|
"cloudpickle >= 1.2.0",
|
||||||
|
"importlib_metadata >= 4.8.0; python_version < '3.10'",
|
||||||
|
"gym_notices >= 0.0.4",
|
||||||
|
"dataclasses == 0.8; python_version == '3.6'",
|
||||||
|
],
|
||||||
license="MIT",
|
license="MIT",
|
||||||
packages=[package for package in find_packages() if package.startswith("gym")],
|
|
||||||
zip_safe=False,
|
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
install_requires=[
|
name="gym",
|
||||||
"numpy>=1.18.0",
|
packages=[package for package in find_packages() if package.startswith("gym")],
|
||||||
"cloudpickle>=1.2.0",
|
|
||||||
"importlib_metadata>=4.8.0; python_version < '3.10'",
|
|
||||||
"gym_notices>=0.0.4",
|
|
||||||
"dataclasses==0.8; python_version == '3.6'",
|
|
||||||
],
|
|
||||||
extras_require=extras,
|
|
||||||
package_data={
|
package_data={
|
||||||
"gym": [
|
"gym": [
|
||||||
"envs/mujoco/assets/*.xml",
|
"envs/mujoco/assets/*.xml",
|
||||||
@@ -83,14 +82,9 @@ setup(
|
|||||||
"py.typed",
|
"py.typed",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
tests_require=["pytest", "mock"],
|
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
classifiers=[
|
tests_require=extras["testing"],
|
||||||
"Programming Language :: Python :: 3",
|
url="https://www.gymlibrary.ml/",
|
||||||
"Programming Language :: Python :: 3.6",
|
version=VERSION,
|
||||||
"Programming Language :: Python :: 3.7",
|
zip_safe=False,
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
@@ -1,2 +1,10 @@
|
|||||||
lz4~=3.1
|
box2d-py==2.3.5
|
||||||
pytest~=6.2
|
lz4>=3.1.0
|
||||||
|
opencv-python>=3.0
|
||||||
|
mujoco==2.2.0
|
||||||
|
matplotlib>=3.0
|
||||||
|
imageio>=2.14.1
|
||||||
|
pygame==2.1.0
|
||||||
|
mujoco_py<2.2,>=2.1
|
||||||
|
pytest
|
||||||
|
mock
|
||||||
|
Reference in New Issue
Block a user