pyproject.toml 4.56 KB
Newer Older
Tim Dettmers's avatar
Tim Dettmers committed
1
[build-system]
2
requires = ["scikit-build-core", "setuptools >= 77.0.3"]
3
build-backend = "scikit_build_core.setuptools.build_meta"
Titus von Koeller's avatar
Titus von Koeller committed
4

5
6
7
8
9
[project]
name = "bitsandbytes"
dynamic = ["version"]
description = "k-bit optimizers and matrix multiplication routines."
authors = [{name="Tim Dettmers", email="dettmers@cs.washington.edu"}]
10
11
12
13
maintainers = [
    {name="Titus von Köller", email="titus@huggingface.co"},
    {name="Matthew Douglas", email="matthew.douglas@huggingface.co"}
]
14
requires-python = ">=3.9"
15
readme = "README.md"
16
17
license = "MIT"
license-files = ["LICENSE"]
18
19
20
21
22
23
24
25
26
27
keywords = [
    "gpu",
    "optimizers",
    "optimization",
    "8-bit",
    "quantization",
    "compression"
]
classifiers = [
    "Development Status :: 4 - Beta",
Matthew Douglas's avatar
Matthew Douglas committed
28
    "Environment :: GPU :: NVIDIA CUDA :: 11.8",
29
    "Environment :: GPU :: NVIDIA CUDA :: 12",
30
    "Environment :: GPU :: NVIDIA CUDA :: 13",
31
32
33
    "Intended Audience :: Developers",
    "Intended Audience :: Science/Research",
    "Operating System :: POSIX :: Linux",
34
    # "Operating System :: MacOS",
35
36
37
38
39
40
41
    "Operating System :: Microsoft :: Windows",
    "Programming Language :: C++",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
42
    "Programming Language :: Python :: 3.13",
43
44
45
    "Topic :: Scientific/Engineering :: Artificial Intelligence"
]
dependencies = [
46
    "torch>=2.3,<3",
47
48
    "numpy>=1.17",
    "packaging>=20.9"
49
50
]

51
52
53
54
55
56
[project.urls]
homepage = "https://github.com/bitsandbytes-foundation/bitsandbytes"
changelog = "https://github.com/bitsandbytes-foundation/bitsandbytes/blob/main/CHANGELOG.md"
docs = "https://huggingface.co/docs/bitsandbytes/main"
issues = "https://github.com/bitsandbytes-foundation/bitsandbytes/issues"

57
58
59
60
61
62
[project.optional-dependencies]
benchmark = ["pandas", "matplotlib"]
docs = ["hf-doc-builder==0.5.0"]
dev = [
    "bitsandbytes[test]",
    "build>=1.0.0,<2",
63
    "ruff==0.11.2",
64
65
66
67
    "pre-commit>=3.5.0,<4",
    "wheel>=0.42,<1"
]
test = [
68
69
70
    "einops~=0.8.0",
    "lion-pytorch==0.2.3",
    "pytest~=8.3",
71
    "scipy>=1.11.4,<2",
72
73
74
75
    "transformers>=4.30.1,<5"
]

[tool.setuptools]
Yuanyuan Chen's avatar
Yuanyuan Chen committed
76
package-data = { "*" = ["libbitsandbytes*.*", "py.typed"] }
77

78
79
80
[tool.setuptools.packages.find]
include = ["bitsandbytes*"]

81
82
83
[tool.setuptools.dynamic]
version = {attr = "bitsandbytes.__version__"}

84
85
86
87
88
89
[tool.coverage.report]
exclude_also = [
    # exclude backward() functions from coverage, as they are invoked from C++
    'def backward\(ctx'
]

90
[tool.pytest.ini_options]
Matthew Douglas's avatar
Matthew Douglas committed
91
addopts = "-rP -m 'not slow and not benchmark and not deprecated'"
92
93
94
95
96
97
98
99
100
101
102
103
104
#    ; --cov=bitsandbytes
#    ; # contexts: record which test ran which line; can be seen in html coverage report
#    ; --cov-context=test
#    ; --cov-report html
log_cli = true
log_cli_level = "INFO"
log_file = "logs/pytest.log"
markers = [
    "benchmark: mark test as a benchmark",
    "deprecated: mark test as covering a deprecated feature",
    "slow: mark test as slow",
]

Titus von Koeller's avatar
Titus von Koeller committed
105
106
107
108
109
110
[tool.ruff]
src = [
    "bitsandbytes",
    "tests",
    "benchmarking"
]
111
target-version = "py39"
112
113
114
line-length = 119

[tool.ruff.lint]
Titus von Koeller's avatar
Titus von Koeller committed
115
116
select = [
    "B",    # bugbear: security warnings
117
118
    "E",    # pycodestyle (error)
    "W",    # pycodestyle (warning)
Titus von Koeller's avatar
Titus von Koeller committed
119
120
121
122
123
124
125
    "F",    # pyflakes
    "I",    # isort
    "ISC",  # implicit string concatenation
    "UP",   # alert you when better syntax is available in your python version
    "RUF",  # the ruff developer's own rules
]
ignore = [
Aarni Koskela's avatar
Aarni Koskela committed
126
127
    "B007",  # Loop control variable not used within the loop body (TODO: enable)
    "B028",  # Warning without stacklevel (TODO: enable)
Yuanyuan Chen's avatar
Yuanyuan Chen committed
128
    "E501",  # Suppress line-too-long warnings: trust yapf's judgement on this one.
Aarni Koskela's avatar
Aarni Koskela committed
129
130
131
132
    "E701",  # Multiple statements on one line (TODO: enable)
    "E712",  # Allow using if x == False, as it's not always equivalent to if x.
    "E731",  # Do not use lambda
    "RUF012",  # Mutable class attribute annotations
133
    "RUF034", # Useless if-else (TODO: enable)
134
    "ISC001",   # single-line-implicit-string-concatenation incompatible with formatter
Titus von Koeller's avatar
Titus von Koeller committed
135
136
]

137
[tool.ruff.lint.extend-per-file-ignores]
Aarni Koskela's avatar
Aarni Koskela committed
138
139
140
141
142
143
144
145
146
147
148
"**/__init__.py" = ["F401"]  # allow unused imports in __init__.py
"{benchmarking,tests}/**/*.py" = [
    "B007",
    "B011",
    "B023",
    "E701",
    "E731",
    "F841",
    "UP030",
]

149
[tool.ruff.lint.isort]
Titus von Koeller's avatar
Titus von Koeller committed
150
151
152
combine-as-imports = true
detect-same-package = true
force-sort-within-sections = true
153
154
155
156
157
158
159
160
161
known-first-party = ["bitsandbytes"]

[[tool.mypy.overrides]]
module = "triton.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "scipy.stats"
ignore_missing_imports = true