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

setup.py 4.0 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. import os
  2. from setuptools import find_packages, setup
  3. from enum import Enum
  4. def read(rel_path: str) -> str:
  5. here = os.path.abspath(os.path.dirname(__file__))
  6. with open(os.path.join(here, rel_path), encoding="utf-8") as fp:
  7. return fp.read()
  8. def get_version(rel_path: str) -> str:
  9. for line in read(rel_path).splitlines():
  10. if line.startswith("__version__"):
  11. delim = '"' if '"' in line else "'"
  12. return line.split(delim)[1]
  13. raise RuntimeError("Unable to find version string.")
  14. # Package meta-data.
  15. NAME = "learnware"
  16. DESCRIPTION = "learnware market project"
  17. REQUIRES_PYTHON = ">=3.6.0"
  18. VERSION = get_version("learnware/__init__.py")
  19. # BEFORE importing setuptools, remove MANIFEST. Otherwise it may not be
  20. # properly updated when the contents of directories change (true for distutils,
  21. # not sure about setuptools).
  22. if os.path.exists("MANIFEST"):
  23. os.remove("MANIFEST")
  24. class SystemType(Enum):
  25. LINUX = 0
  26. MACOS = 1
  27. WINDOWS = 2
  28. def get_platform():
  29. import platform
  30. sys_platform = platform.platform().lower()
  31. if "windows" in sys_platform:
  32. return SystemType.WINDOWS
  33. elif "macos" in sys_platform:
  34. return SystemType.MACOS
  35. elif "linux" in sys_platform:
  36. return SystemType.LINUX
  37. raise SystemError("Learnware only support MACOS/Linux/Windows")
  38. # What packages are required for this module to be executed?
  39. # `estimator` may depend on other packages. In order to reduce dependencies, it is not written here.
  40. REQUIRED = [
  41. "numpy>=1.20.0",
  42. "pandas>=0.25.1",
  43. "scipy>=1.0.0",
  44. "tqdm>=4.65.0",
  45. "scikit-learn>=0.22",
  46. "joblib>=1.2.0",
  47. "pyyaml>=6.0",
  48. "fire>=0.3.1",
  49. "psutil>=5.9.4",
  50. "sqlalchemy>=2.0.21",
  51. "shortuuid>=1.0.11",
  52. "docker>=6.1.3",
  53. "rapidfuzz>=3.4.0",
  54. "langdetect>=1.0.9",
  55. "huggingface-hub<0.18",
  56. "transformers>=4.34.1",
  57. "portalocker>=2.0.0",
  58. "qpsolvers[clarabel]>=4.0.1",
  59. "geatpy>=2.7.0;python_version<'3.11'",
  60. ]
  61. DEV_REQUIRED = [
  62. # For documentations
  63. "sphinx",
  64. "sphinx_rtd_theme",
  65. # CI dependencies
  66. "pytest>=3",
  67. "wheel",
  68. "setuptools",
  69. "pylint",
  70. # For static analysis
  71. "mypy<0.981",
  72. "flake8",
  73. "black==23.1.0",
  74. "pre-commit",
  75. ]
  76. FULL_REQUIRED = [
  77. # The default full requirements for learnware package
  78. "torch==2.1.0",
  79. "torchvision==0.16.0",
  80. "torch-optimizer>=0.3.0",
  81. "sentence_transformers>=2.2.2",
  82. ]
  83. # In MACOS, the lightgbm package should be installed with brew.
  84. if get_platform() != SystemType.MACOS:
  85. FULL_REQUIRED += ["lightgbm>=3.3.0"]
  86. here = os.path.abspath(os.path.dirname(__file__))
  87. with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
  88. long_description = f.read()
  89. if __name__ == "__main__":
  90. setup(
  91. name=NAME,
  92. version=VERSION,
  93. license="MIT Licence",
  94. url="https://github.com/Learnware-LAMDA/Learnware",
  95. packages=find_packages(),
  96. include_package_data=True,
  97. description=DESCRIPTION,
  98. long_description=long_description,
  99. long_description_content_type="text/markdown",
  100. python_requires=REQUIRES_PYTHON,
  101. install_requires=REQUIRED,
  102. extras_require={
  103. "dev": DEV_REQUIRED,
  104. "full": FULL_REQUIRED,
  105. },
  106. classifiers=[
  107. "Intended Audience :: Science/Research",
  108. "Intended Audience :: Developers",
  109. "Programming Language :: Python",
  110. "Topic :: Software Development",
  111. "Topic :: Scientific/Engineering",
  112. "Operating System :: POSIX :: Linux",
  113. "Operating System :: Microsoft :: Windows",
  114. "Operating System :: MacOS",
  115. "Programming Language :: Python :: 3.7",
  116. "Programming Language :: Python :: 3.8",
  117. "Programming Language :: Python :: 3.9",
  118. "Programming Language :: Python :: 3.10",
  119. "Programming Language :: Python :: 3.11",
  120. ],
  121. )