Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
126 lines (116 loc) · 4.77 KB
/
Copy pathsetup.py
File metadata and controls
126 lines (116 loc) · 4.77 KB
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
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
def get_metadata():
metadata = {}
with open("src/dlomix/_metadata.py") as f:
exec(f.read(), metadata)
return metadata
# Load metadata
META_DATA = get_metadata()
# Upper bound = the newest TensorFlow CI actually installs and tests. Raise it
# deliberately after CI passes on the new release, rather than letting users
# silently pick up an untested minor version.
# The floor: numpy>=2.0 (a core requirement) rules out TF 2.16/2.17, which pin numpy<2.
TENSORFLOW_VERSION = ">=2.18,<2.22"
# macOS below Python 3.13: stay below TF 2.20. tensorflow-metal 1.2.0 (the Apple
# GPU plugin, latest release) does not load with TF 2.20+, and once it is installed
# `import tensorflow` fails. It has no Python 3.13 wheels, and TF has none for 3.13
# before 2.20, so Python 3.13 on macOS takes the regular range.
TENSORFLOW_VERSION_MACOS = ">=2.18,<2.20"
MACOS_METAL = "platform_system == 'Darwin' and python_version < '3.13'"
NOT_MACOS_METAL = "(platform_system != 'Darwin' or python_version >= '3.13')"
# Platform differences are expressed as environment markers, evaluated on the
# installing machine. A build-time platform check would be baked into the
# py3-none-any wheel for every platform.
tensorflow_extra_install = [
f"tensorflow{TENSORFLOW_VERSION_MACOS}; {MACOS_METAL}",
f"tensorflow{TENSORFLOW_VERSION}; {NOT_MACOS_METAL}",
]
# CUDA-enabled TensorFlow for Linux GPU machines. tensorflow[and-cuda] installs
# CUDA/cuDNN as pip wheels, which NVIDIA publishes only for Linux; TF's own extra
# carries no platform markers, so ungated it fails to resolve on macOS/Windows.
# Gated here, the extra degrades to the regular build on other platforms.
# Deliberately not part of `dev`: CI has no GPU and should not download CUDA.
tensorflow_cuda_extra_install = [
f"tensorflow[and-cuda]{TENSORFLOW_VERSION}; platform_system == 'Linux'",
f"tensorflow{TENSORFLOW_VERSION_MACOS}; {MACOS_METAL}",
f"tensorflow{TENSORFLOW_VERSION}; platform_system != 'Linux' and {NOT_MACOS_METAL}",
]
# PyTorch needs no GPU extra: its Linux wheels on PyPI are already CUDA builds.
pytorch_extra_install = [
# torch does not declare numpy as a dependency; builds before 2.3 were compiled
# against NumPy 1.x and fail at import under NumPy 2.
"torch>=2.3",
]
setuptools.setup(
name=META_DATA["__package__"].lower(),
version=META_DATA["__version__"],
author=META_DATA["__author__"],
author_email=META_DATA["__author_email__"],
description=META_DATA["__description__"],
long_description=long_description,
long_description_content_type="text/markdown",
url=META_DATA["__github_url__"],
# SPDX expression (setuptools>=77, see pyproject.toml); replaces the deprecated
# license classifier
license_expression="MIT",
packages=setuptools.find_packages(where="src"),
package_dir={"": "src"},
include_package_data=True,
package_data={"": ["data/processing/feature_dicts/*"]},
python_requires=">=3.11",
install_requires=[
"datasets>=4.0.0",
"huggingface_hub>=0.20.0",
# Keras 3 is backend-agnostic and pure Python: it provides the single
# `keras.ops` implementation of the losses and metrics shared by both
# backends, and does not pull in TensorFlow when KERAS_BACKEND=torch.
"keras>=3.0.0",
"fpdf",
"pandas",
"numpy>=2.0",
"matplotlib",
"scikit-learn",
# TF 2.20+ and pyarrow 21 or older deadlock when both are loaded on macOS
# ("mutex lock failed"); pyarrow 22 fixed it
"pyarrow>=22",
"seaborn",
],
extras_require={
"dev": [
"pytest >= 7.0.0",
"pytest-cov",
"black",
"isort", # invoked by `make format` / `make format-check`
"twine",
"setuptools",
"wheel",
"pylint",
*tensorflow_extra_install,
*pytorch_extra_install,
],
"wandb": [
"wandb>=0.20.0",
],
"tensorflow": tensorflow_extra_install,
"tf": tensorflow_extra_install,
"tensorflow-cuda": tensorflow_cuda_extra_install,
"tf-cuda": tensorflow_cuda_extra_install,
"torch": pytorch_extra_install,
"pytorch": pytorch_extra_install,
"lightning": [
"lightning",
],
},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
],
)