From 8e9ce44e00e615b6ceae0238b04080d82f79cc2b Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Thu, 26 Sep 2024 17:44:35 +0100 Subject: [PATCH 1/9] chore: move configs to pyproject.toml --- pyproject.toml | 25 +++++++++++++++++++++++++ pytest.ini | 14 -------------- 2 files changed, 25 insertions(+), 14 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index f0ac2e4b7..9cfe6758e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,31 @@ requires = [ "setuptools", "wheel" ] build-backend = "setuptools.build_meta" +[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" +log_cli = true +log_cli_level = "INFO" +log_file = "logs/pytest.log" +markers = [ + "slow: mark test as slow", + "benchmark: mark test as a benchmark", + "deprecated: mark test as covering a deprecated feature", +] + [tool.ruff] src = [ "bitsandbytes", diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 0090e0ca7..000000000 --- a/pytest.ini +++ /dev/null @@ -1,14 +0,0 @@ -[pytest] -addopts = -rP - ; --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 benchmark - slow: mark test as slow - deprecated: mark test as covering a deprecated feature From 3f77dc94ae058831cd89458f3464ee43a383e340 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Thu, 26 Sep 2024 17:46:39 +0100 Subject: [PATCH 2/9] fix: drop file from CI workflow --- .github/workflows/python-package.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9b166794f..5cd956574 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -14,7 +14,6 @@ on: - "requirements*.txt" - "setup.py" - "pyproject.toml" - - "pytest.ini" release: types: [published] workflow_dispatch: {} # Allow manual trigger From b6b41567ef65bcd9d4766532e7dc0fbfbd327e85 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Sun, 3 Nov 2024 22:38:58 +0000 Subject: [PATCH 3/9] feat: reorder pytest markers --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9cfe6758e..087096c93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,9 @@ log_cli = true log_cli_level = "INFO" log_file = "logs/pytest.log" markers = [ - "slow: mark test as slow", "benchmark: mark test as a benchmark", "deprecated: mark test as covering a deprecated feature", + "slow: mark test as slow", ] [tool.ruff] From cbc3de13aa5d68f9adb967c95ef4e9ccbe453444 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Sun, 3 Nov 2024 22:39:24 +0000 Subject: [PATCH 4/9] chore: retain comments --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 087096c93..8c36f9a95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,10 @@ split_complex_comprehension = true [tool.pytest.ini_options] addopts = "-rP" +# ; --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" From f6ec90c1c64f88ed1c0fdbc3f7507f7d1351e282 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Sun, 3 Nov 2024 22:52:03 +0000 Subject: [PATCH 5/9] chore(build): migrate build data to pyproject Co-authored-by: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> --- pyproject.toml | 74 +++++++++++++++++++++++++++++++++++++++++++- requirements-ci.txt | 6 ---- requirements-dev.txt | 9 ------ setup.py | 36 +-------------------- 4 files changed, 74 insertions(+), 51 deletions(-) delete mode 100644 requirements-ci.txt delete mode 100644 requirements-dev.txt diff --git a/pyproject.toml b/pyproject.toml index 8c36f9a95..eefd27914 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,79 @@ [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="dettmers@cs.washington.edu"}] +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 diff --git a/requirements-ci.txt b/requirements-ci.txt deleted file mode 100644 index 25ff67295..000000000 --- a/requirements-ci.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Requirements used for GitHub actions -pytest==8.3.3 -einops==0.8.0 -lion-pytorch==0.2.2 -scipy==1.10.1; python_version < "3.9" -scipy==1.14.1; python_version >= "3.9" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index aedd07966..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Requirements used for local development -setuptools>=63 -pytest~=8.3.3 -einops~=0.8.0 -wheel~=0.44.0 -lion-pytorch~=0.2.2 -scipy~=1.14.1 -pandas~=2.2.2 -matplotlib~=3.9.2 diff --git a/setup.py b/setup.py index 435641467..7d70bbc17 100644 --- a/setup.py +++ b/setup.py @@ -2,20 +2,9 @@ # # 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), encoding="utf8").read() - # Tested with wheel v0.29.0 class BinaryDistribution(Distribution): @@ -23,27 +12,4 @@ def has_ext_modules(self): return True -setup( - name="bitsandbytes", - version="0.45.1.dev0", - author="Tim Dettmers", - author_email="dettmers@cs.washington.edu", - description="k-bit optimizers and matrix multiplication routines.", - license="MIT", - keywords="gpu optimizers optimization 8-bit quantization compression", - url="https://github.com/bitsandbytes-foundation/bitsandbytes", - packages=find_packages(), - package_data={"": libs}, - install_requires=["torch", "numpy", "typing_extensions>=4.8.0"], - 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.45.1.dev0", packages=find_packages(), distclass=BinaryDistribution) From 0f86a1f86f978da9dabb52f25a84eb7ee2ef1980 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 29 Nov 2024 13:00:01 -0500 Subject: [PATCH 6/9] Apply suggestions from code review Co-authored-by: Aarni Koskela --- pyproject.toml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eefd27914..0ceaaa4e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,20 +74,6 @@ 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 - [tool.pytest.ini_options] addopts = "-rP" # ; --cov=bitsandbytes From 3ee879ab6f658bcc4dda73fea5cc350286a87715 Mon Sep 17 00:00:00 2001 From: Saurav Maheshkar Date: Thu, 26 Sep 2024 17:44:35 +0100 Subject: [PATCH 7/9] chore: move configs to pyproject.toml --- pyproject.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 0ceaaa4e0..eefd27914 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,20 @@ 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 + [tool.pytest.ini_options] addopts = "-rP" # ; --cov=bitsandbytes From 0dd6b5f55d68ec1ca14813e16c9e3e445e5dae62 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Fri, 29 Nov 2024 13:00:01 -0500 Subject: [PATCH 8/9] Apply suggestions from code review Co-authored-by: Aarni Koskela --- pyproject.toml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index eefd27914..0ceaaa4e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,20 +74,6 @@ 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 - [tool.pytest.ini_options] addopts = "-rP" # ; --cov=bitsandbytes From 22637a9393bc0c40baab693ca2a10a20ef3e8979 Mon Sep 17 00:00:00 2001 From: Matthew Douglas <38992547+matthewdouglas@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:43:35 -0500 Subject: [PATCH 9/9] bump ruff --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0ceaaa4e0..3573b10f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ docs = ["hf-doc-builder==0.5.0"] dev = [ "bitsandbytes[test]", "build>=1.0.0,<2", - "ruff==0.3.2", + "ruff==0.6.9", "pre-commit>=3.5.0,<4", "wheel>=0.42,<1" ]