Skip to content

Commit 5b01589

Browse files
SauravMaheshkarmatthewdouglasakx
authored
chore: migrate config files to pyproject.toml (#1373)
* chore: move configs to pyproject.toml * fix: drop file from CI workflow * feat: reorder pytest markers * chore: retain comments * chore(build): migrate build data to pyproject Co-authored-by: Matthew Douglas <[email protected]> * Apply suggestions from code review Co-authored-by: Aarni Koskela <[email protected]> * chore: move configs to pyproject.toml * Apply suggestions from code review Co-authored-by: Aarni Koskela <[email protected]> * bump ruff --------- Co-authored-by: Matthew Douglas <[email protected]> Co-authored-by: Aarni Koskela <[email protected]>
1 parent 032beb9 commit 5b01589

File tree

6 files changed

+89
-66
lines changed

6 files changed

+89
-66
lines changed

.github/workflows/python-package.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ on:
1414
- "requirements*.txt"
1515
- "setup.py"
1616
- "pyproject.toml"
17-
- "pytest.ini"
1817
release:
1918
types: [published]
2019
workflow_dispatch: {} # Allow manual trigger

pyproject.toml

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,94 @@
11
[build-system]
2-
requires = [ "setuptools", "wheel" ]
2+
requires = ["setuptools >= 63.0.0"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "bitsandbytes"
7+
dynamic = ["version"]
8+
description = "k-bit optimizers and matrix multiplication routines."
9+
authors = [{name="Tim Dettmers", email="[email protected]"}]
10+
requires-python = ">=3.8"
11+
readme = "README.md"
12+
license = {file="LICENSE"}
13+
keywords = [
14+
"gpu",
15+
"optimizers",
16+
"optimization",
17+
"8-bit",
18+
"quantization",
19+
"compression"
20+
]
21+
classifiers = [
22+
"Development Status :: 4 - Beta",
23+
"License :: OSI Approved :: MIT License",
24+
"Environment :: GPU :: NVIDIA CUDA :: 11",
25+
"Environment :: GPU :: NVIDIA CUDA :: 12",
26+
"Intended Audience :: Developers",
27+
"Intended Audience :: Science/Research",
28+
"Operating System :: POSIX :: Linux",
29+
"Operating System :: MacOS",
30+
"Operating System :: Microsoft :: Windows",
31+
"Programming Language :: C++",
32+
"Programming Language :: Python :: Implementation :: CPython",
33+
"Programming Language :: Python :: 3.8",
34+
"Programming Language :: Python :: 3.9",
35+
"Programming Language :: Python :: 3.10",
36+
"Programming Language :: Python :: 3.11",
37+
"Programming Language :: Python :: 3.12",
38+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
39+
]
40+
dependencies = [
41+
"torch>=1.11,!=1.12.0",
42+
"numpy>=1.17"
43+
]
44+
45+
[project.optional-dependencies]
46+
benchmark = ["pandas", "matplotlib"]
47+
docs = ["hf-doc-builder==0.5.0"]
48+
dev = [
49+
"bitsandbytes[test]",
50+
"build>=1.0.0,<2",
51+
"ruff==0.6.9",
52+
"pre-commit>=3.5.0,<4",
53+
"wheel>=0.42,<1"
54+
]
55+
test = [
56+
"einops~=0.6.0",
57+
"lion-pytorch==0.0.6",
58+
"pytest~=7.4",
59+
"scipy>=1.10.1,<2; python_version < '3.9'",
60+
"scipy>=1.11.4,<2; python_version >= '3.9'",
61+
"transformers>=4.30.1,<5"
62+
]
63+
triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"]
64+
65+
[project.urls]
66+
homepage = "https://github.com/TimDettmers/bitsandbytes"
67+
changelog = "https://github.com/TimDettmers/bitsandbytes/blob/main/CHANGELOG.md"
68+
docs = "https://huggingface.co/docs/bitsandbytes/main"
69+
issues = "https://github.com/TimDettmers/bitsandbytes/issues"
70+
71+
[tool.setuptools]
72+
package-data = { "*" = ["libbitsandbytes*.*"] }
73+
74+
[tool.setuptools.dynamic]
75+
version = {attr = "bitsandbytes.__version__"}
76+
77+
[tool.pytest.ini_options]
78+
addopts = "-rP"
79+
# ; --cov=bitsandbytes
80+
# ; # contexts: record which test ran which line; can be seen in html coverage report
81+
# ; --cov-context=test
82+
# ; --cov-report html
83+
log_cli = true
84+
log_cli_level = "INFO"
85+
log_file = "logs/pytest.log"
86+
markers = [
87+
"benchmark: mark test as a benchmark",
88+
"deprecated: mark test as covering a deprecated feature",
89+
"slow: mark test as slow",
90+
]
91+
592
[tool.ruff]
693
src = [
794
"bitsandbytes",

pytest.ini

Lines changed: 0 additions & 14 deletions
This file was deleted.

requirements-ci.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,14 @@
22
#
33
# This source code is licensed under the MIT license found in the
44
# LICENSE file in the root directory of this source tree.
5-
import glob
6-
import os
7-
85
from setuptools import find_packages, setup
96
from setuptools.dist import Distribution
107

11-
libs = list(glob.glob("./bitsandbytes/libbitsandbytes*.*"))
12-
libs = [os.path.basename(p) for p in libs]
13-
print("libs:", libs)
14-
15-
16-
def read(fname):
17-
return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf8").read()
18-
198

209
# Tested with wheel v0.29.0
2110
class BinaryDistribution(Distribution):
2211
def has_ext_modules(self):
2312
return True
2413

2514

26-
setup(
27-
name="bitsandbytes",
28-
version="0.45.1.dev0",
29-
author="Tim Dettmers",
30-
author_email="[email protected]",
31-
description="k-bit optimizers and matrix multiplication routines.",
32-
license="MIT",
33-
keywords="gpu optimizers optimization 8-bit quantization compression",
34-
url="https://github.com/bitsandbytes-foundation/bitsandbytes",
35-
packages=find_packages(),
36-
package_data={"": libs},
37-
install_requires=["torch", "numpy", "typing_extensions>=4.8.0"],
38-
extras_require={
39-
"benchmark": ["pandas", "matplotlib"],
40-
"test": ["scipy", "lion_pytorch"],
41-
},
42-
long_description=read("README.md"),
43-
long_description_content_type="text/markdown",
44-
classifiers=[
45-
"Development Status :: 4 - Beta",
46-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
47-
],
48-
distclass=BinaryDistribution,
49-
)
15+
setup(version="0.45.1.dev0", packages=find_packages(), distclass=BinaryDistribution)

0 commit comments

Comments
 (0)