setup.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. """Setups up the Minigrid module."""
  2. from __future__ import annotations
  3. from setuptools import find_packages, setup
  4. def get_description():
  5. """Gets the description from the readme."""
  6. with open("README.md") as fh:
  7. long_description = ""
  8. header_count = 0
  9. for line in fh:
  10. if line.startswith("##"):
  11. header_count += 1
  12. if header_count < 2:
  13. long_description += line
  14. else:
  15. break
  16. return header_count, long_description
  17. def get_version():
  18. """Gets the minigrid version."""
  19. path = "minigrid/__init__.py"
  20. with open(path) as file:
  21. lines = file.readlines()
  22. for line in lines:
  23. if line.startswith("__version__"):
  24. return line.strip().split()[-1].strip().strip('"')
  25. raise RuntimeError("bad version data in __init__.py")
  26. def get_requirements():
  27. """Gets the description from the readme."""
  28. with open("requirements.txt") as reqs_file:
  29. reqs = reqs_file.readlines()
  30. return reqs
  31. def get_tests_requirements():
  32. """Gets the description from the readme."""
  33. with open("test_requirements.txt") as test_reqs_file:
  34. test_reqs = test_reqs_file.readlines()
  35. return test_reqs
  36. # pytest is pinned to 7.0.1 as this is last version for python 3.6
  37. extras = {"testing": get_tests_requirements()}
  38. version = get_version()
  39. header_count, long_description = get_description()
  40. setup(
  41. name="Minigrid",
  42. version=version,
  43. author="Farama Foundation",
  44. author_email="contact@farama.org",
  45. description="Minimalistic gridworld reinforcement learning environments",
  46. url="https://minigrid.farama.org/",
  47. license="Apache",
  48. license_files=("LICENSE",),
  49. long_description=long_description,
  50. long_description_content_type="text/markdown",
  51. keywords=["Memory, Environment, Agent, RL, Gymnasium"],
  52. python_requires=">=3.7, <3.11",
  53. packages=[package for package in find_packages() if package.startswith("minigrid")],
  54. include_package_data=True,
  55. install_requires=get_requirements(),
  56. classifiers=[
  57. "Development Status :: 5 - Production/Stable",
  58. "Programming Language :: Python :: 3",
  59. "Programming Language :: Python :: 3.7",
  60. "Programming Language :: Python :: 3.8",
  61. "Programming Language :: Python :: 3.9",
  62. "Programming Language :: Python :: 3.10",
  63. ],
  64. extras_require=extras,
  65. entry_points={
  66. "gymnasium.envs": ["__root__ = minigrid.__init__:register_minigrid_envs"]
  67. },
  68. tests_require=extras["testing"],
  69. )