Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate config files to pyproject.toml #1373

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Empty file removed .buckconfig
Empty file.
1 change: 0 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
- "requirements*.txt"
- "setup.py"
- "pyproject.toml"
- "pytest.ini"
release:
types: [published]
workflow_dispatch: {} # Allow manual trigger
Expand Down
13 changes: 0 additions & 13 deletions .style.yapf

This file was deleted.

102 changes: 101 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,107 @@
[build-system]
requires = [ "setuptools", "wheel" ]
requires = ["setuptools >= 63.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "bitsandbytes"
dynamic = ["version"]
description = "k-bit optimizers and matrix multiplication routines."
authors = [{name="Tim Dettmers", email="[email protected]"}]
requires-python = ">=3.8"
readme = "README.md"
license = {file="LICENSE"}
keywords = [
"gpu",
"optimizers",
"optimization",
"8-bit",
"quantization",
"compression"
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Environment :: GPU :: NVIDIA CUDA :: 11",
"Environment :: GPU :: NVIDIA CUDA :: 12",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Programming Language :: C++",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence"
]
dependencies = [
"torch>=1.11,!=1.12.0",
"numpy>=1.17"
]

[project.optional-dependencies]
benchmark = ["pandas", "matplotlib"]
docs = ["hf-doc-builder==0.5.0"]
dev = [
"bitsandbytes[test]",
"build>=1.0.0,<2",
"ruff==0.3.2",
"pre-commit>=3.5.0,<4",
"wheel>=0.42,<1"
]
test = [
"einops~=0.6.0",
"lion-pytorch==0.0.6",
"pytest~=7.4",
"scipy>=1.10.1,<2; python_version < '3.9'",
"scipy>=1.11.4,<2; python_version >= '3.9'",
"transformers>=4.30.1,<5"
]
triton = ["triton~=2.0.0; sys_platform=='linux' and platform_machine=='x86_64'"]

[project.urls]
homepage = "https://github.com/TimDettmers/bitsandbytes"
changelog = "https://github.com/TimDettmers/bitsandbytes/blob/main/CHANGELOG.md"
docs = "https://huggingface.co/docs/bitsandbytes/main"
issues = "https://github.com/TimDettmers/bitsandbytes/issues"

[tool.setuptools]
package-data = { "*" = ["libbitsandbytes*.*"] }

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

[tool.yapf]
align_closing_bracket_with_visual_indent = true
allow_multiline_lambdas = true
blank_line_before_nested_class_or_def = true
column_limit = 88
coalesce_brackets = true
space_between_ending_comma_and_closing_bracket = true
spaces_before_comment = 2
split_before_bitwise_operator = true
split_before_first_argument = true
split_before_logical_operator = true
split_before_named_assigns = true
split_complex_comprehension = true

Comment on lines +77 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project uses ruff-format for formatting (see #1081), so this is unnecessary.

Suggested change
[tool.yapf]
align_closing_bracket_with_visual_indent = true
allow_multiline_lambdas = true
blank_line_before_nested_class_or_def = true
column_limit = 88
coalesce_brackets = true
space_between_ending_comma_and_closing_bracket = true
spaces_before_comment = 2
split_before_bitwise_operator = true
split_before_first_argument = true
split_before_logical_operator = true
split_before_named_assigns = true
split_complex_comprehension = true

[tool.pytest.ini_options]
addopts = "-rP"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the commented-out addopts from the old INI file should be retained for documentation.

# ; --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",
"slow: mark test as slow",
]

[tool.ruff]
src = [
"bitsandbytes",
Expand Down
13 changes: 0 additions & 13 deletions pytest.ini

This file was deleted.

6 changes: 0 additions & 6 deletions requirements-ci.txt

This file was deleted.

9 changes: 0 additions & 9 deletions requirements-dev.txt

This file was deleted.

36 changes: 1 addition & 35 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,14 @@
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import glob
import os

from setuptools import find_packages, setup
from setuptools.dist import Distribution

libs = list(glob.glob("./bitsandbytes/libbitsandbytes*.*"))
libs = [os.path.basename(p) for p in libs]
print("libs:", libs)


def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()


# Tested with wheel v0.29.0
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True


setup(
name="bitsandbytes",
version="0.44.2.dev",
author="Tim Dettmers",
author_email="[email protected]",
description="k-bit optimizers and matrix multiplication routines.",
license="MIT",
keywords="gpu optimizers optimization 8-bit quantization compression",
url="https://github.com/TimDettmers/bitsandbytes",
packages=find_packages(),
package_data={"": libs},
install_requires=["torch", "numpy"],
extras_require={
"benchmark": ["pandas", "matplotlib"],
"test": ["scipy", "lion_pytorch"],
},
long_description=read("README.md"),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 4 - Beta",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
distclass=BinaryDistribution,
)
setup(version="0.43.2.dev0", packages=find_packages(), distclass=BinaryDistribution)