Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

setup.py 5.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
  1. #!/usr/bin/env python
  2. """The setup script."""
  3. import sys, re, os
  4. from setuptools import setup, find_packages
  5. from setuptools.command.install import install
  6. from setuptools.command.develop import develop
  7. from setuptools.command.egg_info import egg_info
  8. try:
  9. with open("README.md") as readme_file:
  10. readme = readme_file.read()
  11. except Exception as error:
  12. readme = "No README information found."
  13. sys.stderr.write("Warning: Could not open '%s' due %s\n" % ("README.md", error))
  14. class CustomInstallCommand(install):
  15. def run(self):
  16. install.run(self)
  17. class CustomDevelopCommand(develop):
  18. def run(self):
  19. develop.run(self)
  20. class CustomEggInfoCommand(egg_info):
  21. def run(self):
  22. egg_info.run(self)
  23. try:
  24. filepath = "GANDLF/version.py"
  25. version_file = open(filepath)
  26. (__version__,) = re.findall('__version__ = "(.*)"', version_file.read())
  27. except Exception as error:
  28. __version__ = "0.0.1"
  29. sys.stderr.write("Warning: Could not open '%s' due %s\n" % (filepath, error))
  30. # Handle cases where specific files need to be bundled into the final package as installed via PyPI
  31. dockerfiles = [
  32. item
  33. for item in os.listdir(os.path.dirname(os.path.abspath(__file__)))
  34. if (os.path.isfile(item) and item.startswith("Dockerfile-"))
  35. ]
  36. entrypoint_files = [
  37. item
  38. for item in os.listdir(os.path.dirname(os.path.abspath(__file__)))
  39. if (os.path.isfile(item) and item.startswith("gandlf_"))
  40. ]
  41. setup_files = ["setup.py", ".dockerignore", "pyproject.toml", "MANIFEST.in"]
  42. all_extra_files = dockerfiles + entrypoint_files + setup_files
  43. all_extra_files_pathcorrected = [os.path.join("../", item) for item in all_extra_files]
  44. # find_packages should only ever find these as subpackages of gandlf, not as top-level packages
  45. # generate this dynamically?
  46. # GANDLF.GANDLF is needed to prevent recursion madness in deployments
  47. toplevel_package_excludes = [
  48. "GANDLF.GANDLF",
  49. "anonymize",
  50. "cli",
  51. "compute",
  52. "data",
  53. "grad_clipping",
  54. "losses",
  55. "metrics",
  56. "models",
  57. "optimizers",
  58. "schedulers",
  59. "utils",
  60. ]
  61. # specifying version for `black` separately because it is also used to [check for lint](https://github.com/mlcommons/GaNDLF/blob/master/.github/workflows/black.yml)
  62. black_version = "23.11.0"
  63. requirements = [
  64. "torch==2.1.2",
  65. f"black=={black_version}",
  66. "numpy==1.25.0",
  67. "scipy",
  68. "SimpleITK!=2.0.*",
  69. "SimpleITK!=2.2.1", # https://github.com/mlcommons/GaNDLF/issues/536
  70. "torchvision",
  71. "tqdm",
  72. "torchio==0.19.5",
  73. "pandas>=2.0.0",
  74. "scikit-learn>=0.23.2",
  75. "scikit-image>=0.19.1",
  76. "setuptools",
  77. "seaborn",
  78. "pyyaml",
  79. "tiffslide",
  80. "matplotlib",
  81. "gdown==5.1.0",
  82. "pytest",
  83. "coverage",
  84. "pytest-cov",
  85. "psutil",
  86. "medcam",
  87. "opencv-python",
  88. "torchmetrics==1.1.2",
  89. "zarr==2.10.3",
  90. "pydicom",
  91. "onnx",
  92. "torchinfo==1.7.0",
  93. "segmentation-models-pytorch==0.3.3",
  94. "ACSConv==0.1.1",
  95. "docker",
  96. "dicom-anonymizer==1.0.12",
  97. "twine",
  98. "zarr",
  99. "keyring",
  100. "monai==1.3.0",
  101. "packaging==24.0",
  102. "typer==0.9.0",
  103. ]
  104. if __name__ == "__main__":
  105. setup(
  106. name="GANDLF",
  107. version=__version__,
  108. author="MLCommons",
  109. author_email="gandlf@mlcommons.org",
  110. python_requires=">3.8, <3.12",
  111. packages=find_packages(
  112. where=os.path.dirname(os.path.abspath(__file__)),
  113. exclude=toplevel_package_excludes,
  114. ),
  115. cmdclass={
  116. "install": CustomInstallCommand,
  117. "develop": CustomDevelopCommand,
  118. "egg_info": CustomEggInfoCommand,
  119. },
  120. scripts=[
  121. "gandlf_run",
  122. "gandlf_constructCSV",
  123. "gandlf_collectStats",
  124. "gandlf_patchMiner",
  125. "gandlf_preprocess",
  126. "gandlf_anonymizer",
  127. "gandlf_verifyInstall",
  128. "gandlf_configGenerator",
  129. "gandlf_recoverConfig",
  130. "gandlf_deploy",
  131. "gandlf_optimizeModel",
  132. "gandlf_generateMetrics",
  133. ],
  134. classifiers=[
  135. "Development Status :: 3 - Alpha",
  136. "Intended Audience :: Science/Research",
  137. "License :: OSI Approved :: Apache Software License",
  138. "Natural Language :: English",
  139. "Operating System :: OS Independent",
  140. "Programming Language :: Python :: 3.9",
  141. "Programming Language :: Python :: 3.10",
  142. "Programming Language :: Python :: 3.11",
  143. "Topic :: Scientific/Engineering :: Medical Science Apps.",
  144. ],
  145. description=(
  146. "PyTorch-based framework that handles segmentation/regression/classification using various DL architectures for medical imaging."
  147. ),
  148. install_requires=requirements,
  149. license="Apache-2.0",
  150. long_description=readme,
  151. long_description_content_type="text/markdown",
  152. include_package_data=True,
  153. package_data={"GANDLF": all_extra_files_pathcorrected},
  154. keywords="semantic, segmentation, regression, classification, data-augmentation, medical-imaging, clinical-workflows, deep-learning, pytorch",
  155. zip_safe=False,
  156. )
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...