setup.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import json
  2. import setuptools
  3. from setuptools.command.test import test
  4. from pathlib import Path
  5. PKG_NAME = "archivebox"
  6. DESCRIPTION = "The self-hosted internet archive."
  7. LICENSE = "MIT"
  8. AUTHOR = "Nick Sweeting"
  9. AUTHOR_EMAIL="[email protected]"
  10. REPO_URL = "https://github.com/ArchiveBox/ArchiveBox"
  11. PROJECT_URLS = {
  12. "Source": f"{REPO_URL}",
  13. "Documentation": f"{REPO_URL}/wiki",
  14. "Bug Tracker": f"{REPO_URL}/issues",
  15. "Changelog": f"{REPO_URL}/wiki/Changelog",
  16. "Roadmap": f"{REPO_URL}/wiki/Roadmap",
  17. "Community": f"{REPO_URL}/wiki/Web-Archiving-Community",
  18. "Donate": f"{REPO_URL}/wiki/Donations",
  19. }
  20. ROOT_DIR = Path(__file__).parent.resolve()
  21. PACKAGE_DIR = ROOT_DIR / PKG_NAME
  22. README = (PACKAGE_DIR / "README.md").read_text(encoding='utf-8', errors='ignore')
  23. VERSION = json.loads((PACKAGE_DIR / "package.json").read_text().strip())['version']
  24. PYTHON_REQUIRES = ">=3.7"
  25. SETUP_REQUIRES = ["wheel"]
  26. INSTALL_REQUIRES = [
  27. # only add things here that have corresponding apt python3-packages available
  28. # anything added here also needs to be added to our package dependencies in
  29. # stdeb.cfg (apt), archivebox.rb (brew), Dockerfile, etc.
  30. # if there is no apt python3-package equivalent, then vendor it instead in
  31. # ./archivebox/vendor/
  32. "requests>=2.24.0",
  33. "atomicwrites>=1.4.0",
  34. "mypy-extensions>=0.4.3",
  35. "django>=3.1.3",
  36. "django-extensions>=3.0.3",
  37. "dateparser",
  38. "ipython",
  39. "youtube-dl",
  40. "python-crontab>=2.5.1",
  41. "croniter>=0.3.34",
  42. "w3lib>=1.22.0",
  43. ]
  44. EXTRAS_REQUIRE = {
  45. 'sonic': [
  46. "sonic-client>=0.0.5",
  47. ],
  48. 'dev': [
  49. "setuptools",
  50. "twine",
  51. "wheel",
  52. "flake8",
  53. "ipdb",
  54. "mypy",
  55. "django-stubs",
  56. "sphinx",
  57. "sphinx-rtd-theme",
  58. "recommonmark",
  59. "pytest",
  60. "bottle",
  61. "stdeb",
  62. "django-debug-toolbar",
  63. "djdt_flamegraph",
  64. ],
  65. }
  66. # To see when setup.py gets called (uncomment for debugging):
  67. # import sys
  68. # print(PACKAGE_DIR, f" (v{VERSION})")
  69. # print('>', sys.executable, *sys.argv)
  70. class DisabledTestCommand(test):
  71. def run(self):
  72. # setup.py test is deprecated, disable it here by force so stdeb doesnt run it
  73. print()
  74. print('[X] Running tests via setup.py test is deprecated.')
  75. print(' Hint: Use the ./bin/test.sh script or pytest instead')
  76. setuptools.setup(
  77. name=PKG_NAME,
  78. version=VERSION,
  79. license=LICENSE,
  80. author=AUTHOR,
  81. author_email=AUTHOR_EMAIL,
  82. description=DESCRIPTION,
  83. long_description=README,
  84. long_description_content_type="text/markdown",
  85. url=REPO_URL,
  86. project_urls=PROJECT_URLS,
  87. python_requires=PYTHON_REQUIRES,
  88. setup_requires=SETUP_REQUIRES,
  89. install_requires=INSTALL_REQUIRES,
  90. extras_require=EXTRAS_REQUIRE,
  91. packages=[PKG_NAME],
  92. include_package_data=True, # see MANIFEST.in
  93. entry_points={
  94. "console_scripts": [
  95. f"{PKG_NAME} = {PKG_NAME}.cli:main",
  96. ],
  97. },
  98. classifiers=[
  99. "License :: OSI Approved :: MIT License",
  100. "Natural Language :: English",
  101. "Operating System :: OS Independent",
  102. "Development Status :: 4 - Beta",
  103. "Topic :: Utilities",
  104. "Topic :: System :: Archiving",
  105. "Topic :: System :: Archiving :: Backup",
  106. "Topic :: System :: Recovery Tools",
  107. "Topic :: Sociology :: History",
  108. "Topic :: Internet :: WWW/HTTP",
  109. "Topic :: Internet :: WWW/HTTP :: Indexing/Search",
  110. "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
  111. "Topic :: Software Development :: Libraries :: Python Modules",
  112. "Intended Audience :: Developers",
  113. "Intended Audience :: Education",
  114. "Intended Audience :: End Users/Desktop",
  115. "Intended Audience :: Information Technology",
  116. "Intended Audience :: Legal Industry",
  117. "Intended Audience :: System Administrators",
  118. "Environment :: Console",
  119. "Environment :: Web Environment",
  120. "Programming Language :: Python :: 3",
  121. "Programming Language :: Python :: 3.7",
  122. "Programming Language :: Python :: 3.8",
  123. "Framework :: Django",
  124. "Typing :: Typed",
  125. ],
  126. cmdclass={
  127. "test": DisabledTestCommand,
  128. },
  129. )