|
1 | 1 | """Setups the project."""
|
2 | 2 | import itertools
|
3 |
| -import os.path |
4 |
| -import sys |
| 3 | +import re |
5 | 4 |
|
6 | 5 | from setuptools import find_packages, setup
|
7 | 6 |
|
8 |
| -# Don't import gym module here, since deps may not be installed |
9 |
| -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "gym")) |
10 |
| -from version import VERSION # noqa:E402 |
| 7 | +with open("gym/version.py") as file: |
| 8 | + full_version = file.read() |
| 9 | + assert ( |
| 10 | + re.match(r'VERSION = "\d\.\d+\.\d+"\n', full_version).group(0) == full_version |
| 11 | + ), f"Unexpected version: {full_version}" |
| 12 | + VERSION = re.search(r"\d\.\d+\.\d+", full_version).group(0) |
11 | 13 |
|
12 | 14 | # Environment-specific dependencies.
|
13 | 15 | extras = {
|
|
17 | 19 | "classic_control": ["pygame==2.1.0"],
|
18 | 20 | "mujoco_py": ["mujoco_py<2.2,>=2.1"],
|
19 | 21 | "mujoco": ["mujoco==2.2.0", "imageio>=2.14.1"],
|
20 |
| - "toy_text": ["pygame==2.1.0", "scipy>=1.4.1"], |
| 22 | + "toy_text": ["pygame==2.1.0"], |
21 | 23 | "other": ["lz4>=3.1.0", "opencv-python>=3.0", "matplotlib>=3.0"],
|
22 | 24 | }
|
23 | 25 |
|
24 |
| -# Meta dependency groups. |
25 |
| -nomujoco_blacklist = {"mujoco_py", "mujoco", "accept-rom-license", "atari"} |
26 |
| -nomujoco_groups = set(extras.keys()) - nomujoco_blacklist |
27 |
| - |
28 |
| -extras["nomujoco"] = list( |
29 |
| - itertools.chain.from_iterable(map(lambda group: extras[group], nomujoco_groups)) |
30 |
| -) |
31 |
| - |
32 |
| -noatari_blacklist = {"accept-rom-license", "atari"} |
33 |
| -noatari_groups = set(extras.keys()) - noatari_blacklist |
34 |
| -extras["noatari"] = list( |
35 |
| - itertools.chain.from_iterable(map(lambda group: extras[group], noatari_groups)) |
36 |
| -) |
37 |
| - |
38 |
| -all_blacklist = {"accept-rom-license"} |
39 |
| -all_groups = set(extras.keys()) - all_blacklist |
| 26 | +# Testing dependency groups. |
| 27 | +testing_group = set(extras.keys()) - {"accept-rom-license", "atari"} |
| 28 | +extras["testing"] = list( |
| 29 | + set(itertools.chain.from_iterable(map(lambda group: extras[group], testing_group))) |
| 30 | +) + ["pytest", "mock"] |
40 | 31 |
|
| 32 | +# All dependency groups - accept rom license as requires user to run |
| 33 | +all_groups = set(extras.keys()) - {"accept-rom-license"} |
41 | 34 | extras["all"] = list(
|
42 |
| - itertools.chain.from_iterable(map(lambda group: extras[group], all_groups)) |
| 35 | + set(itertools.chain.from_iterable(map(lambda group: extras[group], all_groups))) |
43 | 36 | )
|
44 | 37 |
|
45 | 38 | # Uses the readme as the description on PyPI
|
|
55 | 48 | break
|
56 | 49 |
|
57 | 50 | setup(
|
58 |
| - name="gym", |
59 |
| - version=VERSION, |
60 |
| - description="Gym: A universal API for reinforcement learning environments", |
61 |
| - url="https://www.gymlibrary.ml/", |
62 | 51 | author="Gym Community",
|
63 | 52 | author_email="jkterry@umd.edu",
|
| 53 | + classifiers=[ |
| 54 | + # Python 3.6 is minimally supported (only with basic gym environments and API) |
| 55 | + "Programming Language :: Python :: 3", |
| 56 | + "Programming Language :: Python :: 3.6", |
| 57 | + "Programming Language :: Python :: 3.7", |
| 58 | + "Programming Language :: Python :: 3.8", |
| 59 | + "Programming Language :: Python :: 3.9", |
| 60 | + "Programming Language :: Python :: 3.10", |
| 61 | + ], |
| 62 | + description="Gym: A universal API for reinforcement learning environments", |
| 63 | + extras_require=extras, |
| 64 | + install_requires=[ |
| 65 | + "numpy >= 1.18.0", |
| 66 | + "cloudpickle >= 1.2.0", |
| 67 | + "importlib_metadata >= 4.8.0; python_version < '3.10'", |
| 68 | + "gym_notices >= 0.0.4", |
| 69 | + "dataclasses == 0.8; python_version == '3.6'", |
| 70 | + ], |
64 | 71 | license="MIT",
|
65 |
| - packages=[package for package in find_packages() if package.startswith("gym")], |
66 |
| - zip_safe=False, |
67 | 72 | long_description=long_description,
|
68 | 73 | long_description_content_type="text/markdown",
|
69 |
| - install_requires=[ |
70 |
| - "numpy>=1.18.0", |
71 |
| - "cloudpickle>=1.2.0", |
72 |
| - "importlib_metadata>=4.8.0; python_version < '3.10'", |
73 |
| - "gym_notices>=0.0.4", |
74 |
| - "dataclasses==0.8; python_version == '3.6'", |
75 |
| - ], |
76 |
| - extras_require=extras, |
| 74 | + name="gym", |
| 75 | + packages=[package for package in find_packages() if package.startswith("gym")], |
77 | 76 | package_data={
|
78 | 77 | "gym": [
|
79 | 78 | "envs/mujoco/assets/*.xml",
|
|
83 | 82 | "py.typed",
|
84 | 83 | ]
|
85 | 84 | },
|
86 |
| - tests_require=["pytest", "mock"], |
87 | 85 | python_requires=">=3.6",
|
88 |
| - classifiers=[ |
89 |
| - "Programming Language :: Python :: 3", |
90 |
| - "Programming Language :: Python :: 3.6", |
91 |
| - "Programming Language :: Python :: 3.7", |
92 |
| - "Programming Language :: Python :: 3.8", |
93 |
| - "Programming Language :: Python :: 3.9", |
94 |
| - "Programming Language :: Python :: 3.10", |
95 |
| - ], |
| 86 | + tests_require=extras["testing"], |
| 87 | + url="https://www.gymlibrary.ml/", |
| 88 | + version=VERSION, |
| 89 | + zip_safe=False, |
96 | 90 | )
|
0 commit comments