Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
256 lines (230 loc) · 13.1 KB
/
Copy pathpyproject.toml
File metadata and controls
256 lines (230 loc) · 13.1 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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
[build-system]
requires = [
"packaging",
"setuptools",
"wheel",
]
build-backend = "setuptools.build_meta"
# We're not building the project itself
[tool.setuptools]
py-modules = []
[project]
name = "tabbyAPI"
version = "0.0.1"
description = "An OAI compatible exllamav3 API that's both lightweight and fast"
requires-python = ">=3.10"
dependencies = [
"fastapi-slim >= 0.115",
"pydantic >= 2.11, < 3",
"ruamel.yaml",
"rich",
"uvicorn >= 0.28.1",
"jinja2 >= 3.0.0",
"loguru",
"sse-starlette >= 2.2.0",
"packaging",
"tokenizers >= 0.21.0",
"numpy",
"aiofiles",
"aiohttp",
"async_lru",
"huggingface_hub",
"psutil",
"httptools >= 0.5.0",
"pillow",
"requests",
# Improved asyncio loops
"uvloop ; platform_system == 'Linux' and platform_machine == 'x86_64'",
"winloop ; platform_system == 'Windows'",
# For python 3.12
"setuptools ; python_version >= '3.12'"
]
[project.urls]
"Homepage" = "https://github.com/theroyallab/tabbyAPI"
[project.optional-dependencies]
extras = [
# Heavy dependencies that aren't for everyday use
"infinity-emb",
# Match the bound infinity-emb declares for its torch engine
"sentence-transformers < 4.0",
# infinity-emb uses the pre-1.0 huggingface_hub API (HfFolder) and doesn't
# bound it upstream. See issue #414.
"huggingface_hub < 1.0",
]
dev = [
"ruff == 0.11.10"
]
cu12 = [
# Torch (Extra index URLs not support in pyproject.toml)
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp313-cp313-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.13'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp312-cp312-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.12'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp311-cp311-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.11'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp310-cp310-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.10'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp313-cp313-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.13'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp312-cp312-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.12'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp311-cp311-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.11'",
"torch @ https://download.pytorch.org/whl/cu128/torch-2.9.0%2Bcu128-cp310-cp310-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.10'",
# Triton
"triton ; platform_system == 'Linux' and platform_machine == 'x86_64'",
"triton-windows ; platform_system == 'Windows'",
# Flash Linear Attention
"flash-linear-attention >= 0.5.0 ; (platform_system == 'Linux' and platform_machine == 'x86_64') or platform_system == 'Windows'",
# Exl3
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp313-cp313-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.13'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp312-cp312-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.12'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp311-cp311-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.11'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp310-cp310-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.10'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.13'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.12'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp311-cp311-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.11'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4+cu128.torch2.9.0-cp310-cp310-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.10'",
]
cu13 = [
# Torch (Extra index URLs not support in pyproject.toml)
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp314-cp314-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.14'",
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp313-cp313-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.13'",
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp312-cp312-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.12'",
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp314-cp314-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.14'",
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp313-cp313-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.13'",
"torch @ https://download.pytorch.org/whl/cu130/torch-2.11.0%2Bcu130-cp312-cp312-manylinux_2_28_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.12'",
# Triton
"triton ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version >= '3.12'",
"triton-windows ; platform_system == 'Windows' and python_version >= '3.12'",
# Flash Linear Attention
"flash-linear-attention >= 0.5.0 ; python_version >= '3.12' and ((platform_system == 'Linux' and platform_machine == 'x86_64') or platform_system == 'Windows')",
# Exl3
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp314-cp314-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.14'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp313-cp313-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.13'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp312-cp312-win_amd64.whl ; platform_system == 'Windows' and python_version == '3.12'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp314-cp314-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.14'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.13'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Bcu132.torch2.11.0-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.12'",
]
rocm = [
# AMD's pip-native ROCm 10 stack ("TheRock"): the runtime comes from pip, no system
# ROCm needed, only the kernel driver. These resolve from AMD's indexes
# (stable.repo.amd.com/rocm/pytorch/whl-next and .../rocm/core/whl-next), which
# start.py and docker/Dockerfile.rocm pass on the command line (pyproject can't carry
# an index URL), together with a per-GPU amd-torch-device-gfxNNNN package. The indexes
# also carry newer lines, so everything is pinned. The torch pinned here is the AMD
# build the exllamav3 ROCm wheels are built against; bump the two together. Linux
# only; Windows ROCm stays on a JIT build of exllamav3 for now.
"torch == 2.13.0+rocm10.0.0 ; platform_system == 'Linux' and platform_machine == 'x86_64'",
"rocm[libraries] == 10.0.0 ; platform_system == 'Linux' and platform_machine == 'x86_64'",
# Triton: torch's own pin pulls in the matching ROCm build. flash-linear-attention is
# not needed: exllamav3 vendors the kernels it uses
# Exl3. One wheel covers every RDNA generation (gfx10-1, gfx10-3, gfx11 and gfx12
# generic targets); CDNA (Instinct) needs a JIT build
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Brocm10.0.torch2.13.0-cp314-cp314-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.14'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Brocm10.0.torch2.13.0-cp313-cp313-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.13'",
"exllamav3 @ https://github.com/turboderp-org/exllamav3/releases/download/v1.6.4/exllamav3-1.6.4%2Brocm10.0.torch2.13.0-cp312-cp312-linux_x86_64.whl ; platform_system == 'Linux' and platform_machine == 'x86_64' and python_version == '3.12'",
]
# MARK: Ruff options
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".git",
".git-rewrite",
".mypy_cache",
".pyenv",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"__pypackages__",
"_build",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"colab",
"docker",
]
# For dev/debug purposes
extend-exclude = ["*_test_.py"]
# Same as Black.
line-length = 100
indent-width = 4
# Assume Python 3.10
target-version = "py310"
[tool.ruff.lint]
# Enable preview
preview = true
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
# Enable flake8-bugbear (`B`) rules, in addition to the defaults.
select = ["E4", "E7", "E9", "F", "B"]
extend-select = [
"D419", # empty-docstring
"PLC2401", # non-ascii-name
"E501", # line-too-long
"W291", # trailing-whitespace
"PLC0414", # useless-import-alias
"PLE0101", # return-in-init
"F706", # return-outside-function
"F704", # yield-outside-function
"PLE0116", # continue-in-finally
"PLE0117", # nonlocal-without-binding
"PLE0241", # duplicate-bases
"PLE0302", # unexpected-special-method-signature
"PLE0604", # invalid-all-object
"PLE0704", # misplaced-bare-raise
"PLE1205", # logging-too-many-args
"PLE1206", # logging-too-few-args
"PLE1307", # bad-string-format-type
"PLE1310", # bad-str-strip-call
"PLE1507", # invalid-envvar-value
"PLR0124", # comparison-with-itself
"PLR0202", # no-classmethod-decorator
"PLR0203", # no-staticmethod-decorator
"PLR0206", # property-with-parameters
"PLR1704", # redefined-argument-from-local
"PLR1711", # useless-return
"C416", # unnecessary-comprehension
"PLW0108", # unnecessary-lambda
"PLW0127", # self-assigning-variable
"PLW0129", # assert-on-string-literal
"PLW0602", # global-variable-not-assigned
"PLW0604", # global-at-module-level
"F401", # unused-import
"F841", # unused-variable
"E722", # bare-except
"PLW0711", # binary-op-exception
"PLW1501", # bad-open-mode
"PLW1508", # invalid-envvar-default
"PLW1509", # subprocess-popen-preexec-fn
]
ignore = [
"PLR6301", # no-self-use
"UP004", # useless-object-inheritance
"PLR0904", # too-many-public-methods
"PLR0911", # too-many-return-statements
"PLR0912", # too-many-branches
"PLR0913", # too-many-arguments
"PLR0914", # too-many-locals
"PLR0915", # too-many-statements
"PLR0916", # too-many-boolean-expressions
"PLW0120", # useless-else-on-loop
"PLW0406", # import-self
"PLW0603", # global-statement
"PLW1641", # eq-without-hash
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = ["B"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Don't format/validate test scripts
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["ALL"]