mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-07-31 13:54:31 +00:00
Update setup.py
This commit is contained in:
42
setup.py
42
setup.py
@@ -4,12 +4,28 @@ import re
|
|||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
with open("gymnasium/version.py") as file:
|
def get_description():
|
||||||
full_version = file.read()
|
with open("README.md") as file:
|
||||||
assert (
|
long_description = ""
|
||||||
re.match(r'VERSION = "\d\.\d+\.\d+"\n', full_version).group(0) == full_version
|
header_count = 0
|
||||||
), f"Unexpected version: {full_version}"
|
for line in file:
|
||||||
VERSION = re.search(r"\d\.\d+\.\d+", full_version).group(0)
|
if line.startswith("##"):
|
||||||
|
header_count += 1
|
||||||
|
if header_count < 2:
|
||||||
|
long_description += line
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
return header_count, long_description
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
"""Gets the pettingzoo version."""
|
||||||
|
path = "gymnasium/version.py"
|
||||||
|
with open(path) as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
assert (
|
||||||
|
re.match(r'VERSION = "\d\.\d+\.\d+"\n', full_version).group(0) == full_version
|
||||||
|
), f"Unexpected version: {full_version}"
|
||||||
|
return re.search(r"\d\.\d+\.\d+", full_version).group(0)
|
||||||
|
|
||||||
# Environment-specific dependencies.
|
# Environment-specific dependencies.
|
||||||
extras = {
|
extras = {
|
||||||
@@ -35,17 +51,7 @@ extras["all"] = list(
|
|||||||
set(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
|
header_count, long_description = get_description()
|
||||||
with open("README.md") as fh:
|
|
||||||
long_description = ""
|
|
||||||
header_count = 0
|
|
||||||
for line in fh:
|
|
||||||
if line.startswith("##"):
|
|
||||||
header_count += 1
|
|
||||||
if header_count < 2:
|
|
||||||
long_description += line
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
author="Farama Foundation",
|
author="Farama Foundation",
|
||||||
@@ -87,6 +93,6 @@ setup(
|
|||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
tests_require=extras["testing"],
|
tests_require=extras["testing"],
|
||||||
url="https://gymnasium.farama.org/",
|
url="https://gymnasium.farama.org/",
|
||||||
version=VERSION,
|
version=get_version(),
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user