You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
976 B

3 months ago
  1. """Setups the project."""
  2. from __future__ import annotations
  3. import pathlib
  4. from setuptools import setup
  5. CWD = pathlib.Path(__file__).absolute().parent
  6. def get_version():
  7. """Gets the minigrid version."""
  8. path = CWD / "minigrid" / "__init__.py"
  9. content = path.read_text()
  10. for line in content.splitlines():
  11. if line.startswith("__version__"):
  12. return line.strip().split()[-1].strip().strip('"')
  13. raise RuntimeError("bad version data in __init__.py")
  14. def get_description():
  15. """Gets the description from the readme."""
  16. with open("README.md") as fh:
  17. long_description = ""
  18. header_count = 0
  19. for line in fh:
  20. if line.startswith("##"):
  21. header_count += 1
  22. if header_count < 2:
  23. long_description += line
  24. else:
  25. break
  26. return long_description
  27. setup(name="minigrid", version=get_version(), long_description=get_description())