Skip to content

Commit fb2c5f7

Browse files
authored
Merge pull request #350 from abetlen/migrate-to-scikit-build-core
Migrate to scikit-build-core
2 parents 202ed44 + b025a85 commit fb2c5f7

10 files changed

+79
-147
lines changed

Diff for: .github/workflows/build-and-release.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ jobs:
2222
- uses: actions/setup-python@v3
2323

2424
- name: Install cibuildwheel
25-
run: python -m pip install cibuildwheel==2.12.1
25+
run: python3 -m pip install cibuildwheel==2.12.1
2626

2727
- name: Install dependencies
2828
run: |
29-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
29+
python3 -m pip install --upgrade pip
30+
python3 -m pip install --verbose --editable .
3031
3132
- name: Build wheels
32-
run: python -m cibuildwheel --output-dir wheelhouse
33+
run: python3 -m cibuildwheel --output-dir wheelhouse
3334

3435
- uses: actions/upload-artifact@v3
3536
with:
@@ -46,10 +47,11 @@ jobs:
4647
- uses: actions/setup-python@v3
4748
- name: Install dependencies
4849
run: |
49-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
50+
python3 -m pip install --upgrade pip build
51+
python3 -m pip install --verbose --editable .
5052
- name: Build source distribution
5153
run: |
52-
python setup.py sdist
54+
python3 -m build --sdist
5355
- uses: actions/upload-artifact@v3
5456
with:
5557
path: ./dist/*.tar.gz

Diff for: .github/workflows/build-docker.yaml

-39
This file was deleted.

Diff for: .github/workflows/publish-to-test.yaml

-30
This file was deleted.

Diff for: .github/workflows/publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
python-version: "3.8"
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
22+
python3 -m pip install --upgrade pip build
2323
- name: Build source distribution
2424
run: |
25-
python setup.py sdist
25+
python3 -m build --sdist
2626
- name: Publish distribution to PyPI
2727
# TODO: move to tag based releases
2828
# if: startsWith(github.ref, 'refs/tags')

Diff for: .github/workflows/test.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
python-version: ${{ matrix.python-version }}
2727
- name: Install dependencies
2828
run: |
29-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
30-
pip install . -v
29+
python3 -m pip install --upgrade pip
30+
python3 -m pip install --verbose --editable .[server,test]
3131
- name: Test with pytest
3232
run: |
33-
pytest
33+
python3 -m pytest
3434
3535
build-windows:
3636

@@ -49,11 +49,11 @@ jobs:
4949
python-version: ${{ matrix.python-version }}
5050
- name: Install dependencies
5151
run: |
52-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
53-
pip install . -v
52+
python3 -m pip install --upgrade pip
53+
python3 -m pip install --verbose --editable .[server,test]
5454
- name: Test with pytest
5555
run: |
56-
pytest
56+
python3 -m pytest
5757
5858
build-macos:
5959

@@ -72,8 +72,8 @@ jobs:
7272
python-version: ${{ matrix.python-version }}
7373
- name: Install dependencies
7474
run: |
75-
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
76-
pip install . -v
75+
python3 -m pip install --upgrade pip
76+
python3 -m pip install --verbose --editable .[server,test]
7777
- name: Test with pytest
7878
run: |
79-
pytest
79+
python3 -m pytest

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- (build-system) Migrate from scikit-build to scikit-build-core
11+
1012
## [v0.1.59]
1113

1214
### Added

Diff for: CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ if (UNIX AND NOT FORCE_CMAKE)
1818
)
1919
install(
2020
FILES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
21-
DESTINATION llama_cpp
21+
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
2222
)
2323
else()
2424
set(BUILD_SHARED_LIBS "On")
2525
add_subdirectory(vendor/llama.cpp)
2626
install(
2727
TARGETS llama
28-
LIBRARY DESTINATION llama_cpp
29-
RUNTIME DESTINATION llama_cpp
30-
ARCHIVE DESTINATION llama_cpp
31-
FRAMEWORK DESTINATION llama_cpp
28+
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
29+
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
30+
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
31+
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
3232
)
3333
endif()

Diff for: Makefile

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
update:
22
poetry install
3+
python3 -m pip install --upgrade pip
34
git submodule update --init --recursive
45

56
update.vendor:
67
cd vendor/llama.cpp && git pull origin master
78

89
build:
9-
python3 setup.py develop
10+
python3 -m pip install --upgrade pip
11+
python3 -m pip install --verbose --editable .
1012

1113
build.cuda:
12-
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 python3 setup.py develop
14+
python3 -m pip install --upgrade pip
15+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
1316

1417
build.opencl:
15-
CMAKE_ARGS="-DLLAMA_CLBLAST=on" FORCE_CMAKE=1 python3 setup.py develop
18+
python3 -m pip install --upgrade pip
19+
CMAKE_ARGS="-DLLAMA_CLBLAST=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
1620

1721
build.openblas:
18-
CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 python3 setup.py develop
22+
python3 -m pip install --upgrade pip
23+
CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
1924

2025
build.blis:
21-
CMAKE_ARGS="-DLLAMA_OPENBLAS=on -DLLAMA_OPENBLAS_VENDOR=blis" FORCE_CMAKE=1 python3 setup.py develop
26+
python3 -m pip install --upgrade pip
27+
CMAKE_ARGS="-DLLAMA_OPENBLAS=on -DLLAMA_OPENBLAS_VENDOR=blis" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
2228

2329
build.metal:
24-
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 python3 setup.py develop
30+
python3 -m pip install --upgrade pip
31+
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
2532

2633
build.sdist:
27-
python3 setup.py sdist
34+
python3 -m pip install --upgrade pip build
35+
python3 -m build --sdist
2836

2937
deploy.pypi:
3038
python3 -m twine upload dist/*
@@ -36,7 +44,6 @@ deploy.gh-docs:
3644
clean:
3745
- cd vendor/llama.cpp && make clean
3846
- cd vendor/llama.cpp && rm libllama.so
39-
- rm -rf _skbuild
4047
- rm llama_cpp/*.so
4148
- rm llama_cpp/*.dylib
4249
- rm llama_cpp/*.dll

Diff for: pyproject.toml

+39-17
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,47 @@
1-
[tool.poetry]
1+
[build-system]
2+
requires = [
3+
"scikit-build-core>=0.4.4",
4+
"cmake>=3.18",
5+
"ninja",
6+
]
7+
build-backend = "scikit_build_core.build"
8+
9+
[project]
210
name = "llama_cpp_python"
311
version = "0.1.59"
412
description = "Python bindings for the llama.cpp library"
5-
authors = ["Andrei Betlen <[email protected]>"]
6-
license = "MIT"
713
readme = "README.md"
8-
homepage = "https://github.com/abetlen/llama-cpp-python"
9-
repository = "https://github.com/abetlen/llama-cpp-python"
10-
packages = [{include = "llama_cpp"}]
11-
include = [
12-
"LICENSE.md",
14+
license = { text = "MIT" }
15+
authors = [
16+
{ name = "Andrei Betlen", email = "[email protected]" },
17+
]
18+
requires-python = ">=3.7"
19+
dependencies = [
20+
"typing-extensions>=4.5.0",
21+
"numpy>=1.20.0",
22+
"diskcache>=5.6.1",
1323
]
24+
classifiers = [
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3.7",
27+
"Programming Language :: Python :: 3.8",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
]
32+
33+
[tool.scikit-build]
34+
wheel.packages = ["llama_cpp", "llama_cpp.server"]
35+
wheel.expand-macos-universal-tags = true
36+
cmake.verbose = true
37+
38+
[project.optional-dependencies]
39+
server = [
40+
"uvicorn",
41+
"fastapi",
42+
"sse-starlette",
43+
]
44+
test = ["pytest", "httpx"]
1445

1546
[tool.poetry.dependencies]
1647
python = "^3.8.1"
@@ -33,12 +64,3 @@ scikit-build = "0.17.6"
3364

3465
[tool.poetry.extras]
3566
server = ["uvicorn", "fastapi", "sse-starlette"]
36-
37-
[build-system]
38-
requires = [
39-
"setuptools>=42",
40-
"scikit-build>=0.13",
41-
"cmake>=3.18",
42-
"ninja",
43-
]
44-
build-backend = "setuptools.build_meta"

Diff for: setup.py

-32
This file was deleted.

0 commit comments

Comments
 (0)