Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include CMakeLists.txt
graft csrc
graft include
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools >= 63.0.0"]
build-backend = "setuptools.build_meta"
requires = ["scikit-build-core", "setuptools >= 63.0.0"]
build-backend = "scikit_build_core.setuptools.build_meta"

[project]
name = "bitsandbytes"
Expand Down
28 changes: 27 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from distutils.errors import DistutilsModuleError
from warnings import warn

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


Expand All @@ -12,4 +16,26 @@ def has_ext_modules(self):
return True


setup(version="0.47.0.dev0", packages=find_packages(), distclass=BinaryDistribution)
class ExtBuildPy(build_py):
def run(self):
# build_cmake needs to be called prior to build_py, as the latter
# collects the files output into the package directory.
try:
self.run_command("build_cmake")
except DistutilsModuleError:
warn(
"scikit-build-core not installed, CMake will not be invoked automatically. "
"Please install scikit-build-core or run CMake manually to build extensions."
)
super().run()


setup(
version="0.47.0.dev0",
packages=find_packages(),
distclass=BinaryDistribution,
cmake_source_dir=".",
cmdclass={
"build_py": ExtBuildPy,
},
)