setup.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. """
  2. .. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
  3. """
  4. import os.path
  5. from typing import Dict
  6. import setuptools
  7. MODULE_NAME = "DateTimeRange"
  8. REPOSITORY_URL = f"https://github.com/thombashi/{MODULE_NAME:s}"
  9. REQUIREMENT_DIR = "requirements"
  10. ENCODING = "utf8"
  11. pkg_info: Dict[str, str] = {}
  12. def get_release_command_class() -> Dict[str, setuptools.Command]:
  13. try:
  14. from releasecmd import ReleaseCommand
  15. except ImportError:
  16. return {}
  17. return {"release": ReleaseCommand}
  18. with open(os.path.join(MODULE_NAME.lower(), "__version__.py")) as f:
  19. exec(f.read(), pkg_info)
  20. with open("README.rst", encoding=ENCODING) as fp:
  21. long_description = fp.read()
  22. with open(os.path.join("docs", "pages", "introduction", "summary.txt"), encoding=ENCODING) as f:
  23. summary = f.read().strip()
  24. with open(os.path.join(REQUIREMENT_DIR, "requirements.txt")) as f:
  25. install_requires = [line.strip() for line in f if line.strip()]
  26. with open(os.path.join(REQUIREMENT_DIR, "test_requirements.txt")) as f:
  27. tests_requires = [line.strip() for line in f if line.strip()]
  28. setuptools.setup(
  29. name=MODULE_NAME,
  30. version=pkg_info["__version__"],
  31. url=REPOSITORY_URL,
  32. author=pkg_info["__author__"],
  33. author_email=pkg_info["__email__"],
  34. description=summary,
  35. include_package_data=True,
  36. keywords=["datetimerange", "datetime", "time range"],
  37. license=pkg_info["__license__"],
  38. long_description=long_description,
  39. long_description_content_type="text/x-rst",
  40. packages=setuptools.find_packages(exclude=["test*"]),
  41. project_urls={
  42. "Documentation": f"https://{MODULE_NAME.lower():s}.rtfd.io/",
  43. "Source": REPOSITORY_URL,
  44. "Tracker": f"{REPOSITORY_URL:s}/issues",
  45. },
  46. python_requires=">=3.6",
  47. install_requires=install_requires,
  48. tests_require=tests_requires,
  49. extras_require={"test": tests_requires},
  50. classifiers=[
  51. "Development Status :: 5 - Production/Stable",
  52. "Intended Audience :: Developers",
  53. "Intended Audience :: Information Technology",
  54. "License :: OSI Approved :: MIT License",
  55. "Operating System :: OS Independent",
  56. "Programming Language :: Python :: 3",
  57. "Programming Language :: Python :: 3.6",
  58. "Programming Language :: Python :: 3.7",
  59. "Programming Language :: Python :: 3.8",
  60. "Programming Language :: Python :: 3.9",
  61. "Programming Language :: Python :: 3.10",
  62. "Programming Language :: Python :: 3 :: Only",
  63. "Topic :: Software Development :: Libraries",
  64. "Topic :: Software Development :: Libraries :: Python Modules",
  65. "Topic :: Text Processing",
  66. ],
  67. cmdclass=get_release_command_class(),
  68. )