Skip to content

Commit e3542b6

Browse files
committed
Revert "Merge pull request #350 from abetlen/migrate-to-scikit-build-core"
This reverts commit fb2c5f7, reversing changes made to 202ed44.
1 parent 3c6e1b6 commit e3542b6

File tree

10 files changed

+149
-86
lines changed

10 files changed

+149
-86
lines changed

.github/workflows/build-and-release.yaml

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

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

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

3534
- uses: actions/upload-artifact@v3
3635
with:
@@ -47,11 +46,10 @@ jobs:
4746
- uses: actions/setup-python@v3
4847
- name: Install dependencies
4948
run: |
50-
python3 -m pip install --upgrade pip build
51-
python3 -m pip install --verbose --editable .
49+
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
5250
- name: Build source distribution
5351
run: |
54-
python3 -m build --sdist
52+
python setup.py sdist
5553
- uses: actions/upload-artifact@v3
5654
with:
5755
path: ./dist/*.tar.gz

.github/workflows/build-docker.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build Docker
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: write
7+
packages: write
8+
9+
jobs:
10+
docker:
11+
name: Build and push Docker image
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
submodules: "true"
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v2
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v2
24+
25+
- name: Login to GitHub Container Registry
26+
uses: docker/login-action@v2
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.repository_owner }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Build and push
33+
uses: docker/build-push-action@v4
34+
with:
35+
context: .
36+
push: true # push to registry
37+
pull: true # always fetch the latest base images
38+
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
39+
tags: ghcr.io/abetlen/llama-cpp-python:latest
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Based on: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2+
3+
name: Publish to TestPyPI
4+
5+
on: workflow_dispatch
6+
7+
jobs:
8+
build-n-publish:
9+
name: Build and publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
submodules: "true"
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.8"
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
23+
- name: Build source distribution
24+
run: |
25+
python setup.py sdist
26+
- name: Publish to Test PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
with:
29+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
30+
repository-url: https://test.pypi.org/legacy/

.github/workflows/publish.yaml

Lines changed: 2 additions & 2 deletions
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-
python3 -m pip install --upgrade pip build
22+
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
2323
- name: Build source distribution
2424
run: |
25-
python3 -m build --sdist
25+
python setup.py sdist
2626
- name: Publish distribution to PyPI
2727
# TODO: move to tag based releases
2828
# if: startsWith(github.ref, 'refs/tags')

.github/workflows/test.yaml

Lines changed: 9 additions & 9 deletions
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-
python3 -m pip install --upgrade pip
30-
python3 -m pip install --verbose --editable .[server,test]
29+
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
30+
pip install . -v
3131
- name: Test with pytest
3232
run: |
33-
python3 -m pytest
33+
pytest
3434
3535
build-windows:
3636

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

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

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [0.1.60]
1111

12-
#### Addeed
12+
### NOTE
1313

14-
- (build-system) Migrate from scikit-build to scikit-build-core
14+
- This release was deleted due to a bug with the packaging system that caused pip installations to fail.
1515

1616
### Fixed
1717

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
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 ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
21+
DESTINATION 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 ${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
28+
LIBRARY DESTINATION llama_cpp
29+
RUNTIME DESTINATION llama_cpp
30+
ARCHIVE DESTINATION llama_cpp
31+
FRAMEWORK DESTINATION llama_cpp
3232
)
3333
endif()

Makefile

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
update:
22
poetry install
3-
python3 -m pip install --upgrade pip
43
git submodule update --init --recursive
54

65
update.vendor:
76
cd vendor/llama.cpp && git pull origin master
87

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

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

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

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

2520
build.blis:
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 .
21+
CMAKE_ARGS="-DLLAMA_OPENBLAS=on -DLLAMA_OPENBLAS_VENDOR=blis" FORCE_CMAKE=1 python3 setup.py develop
2822

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

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

3729
deploy.pypi:
3830
python3 -m twine upload dist/*
@@ -44,6 +36,7 @@ deploy.gh-docs:
4436
clean:
4537
- cd vendor/llama.cpp && make clean
4638
- cd vendor/llama.cpp && rm libllama.so
39+
- rm -rf _skbuild
4740
- rm llama_cpp/*.so
4841
- rm llama_cpp/*.dylib
4942
- rm llama_cpp/*.dll

pyproject.toml

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,17 @@
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]
1+
[tool.poetry]
102
name = "llama_cpp_python"
113
version = "0.1.60"
124
description = "Python bindings for the llama.cpp library"
5+
authors = ["Andrei Betlen <[email protected]>"]
6+
license = "MIT"
137
readme = "README.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",
23-
]
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",
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",
3113
]
3214

33-
[project.urls]
34-
Homepage = "https://github.com/abetlen/llama-cpp-python"
35-
Documentation = "https://abetlen.github.io/llama-cpp-python"
36-
Discussions = "https://github.com/abetlen/llama-cpp-python/discussions"
37-
Issues = "https://github.com/abetlen/llama-cpp-python/issues"
38-
Changelog = "https://github.com/abetlen/llama-cpp-python/blob/main/CHANGELOG.md"
39-
40-
[tool.scikit-build]
41-
wheel.packages = ["llama_cpp", "llama_cpp.server"]
42-
wheel.expand-macos-universal-tags = true
43-
cmake.verbose = true
44-
45-
[project.optional-dependencies]
46-
server = [
47-
"uvicorn",
48-
"fastapi",
49-
"sse-starlette",
50-
]
51-
test = ["pytest", "httpx"]
52-
5315
[tool.poetry]
5416
name = "llama_cpp_python"
5517
version = "0.1.60"
@@ -77,3 +39,12 @@ scikit-build = "0.17.6"
7739

7840
[tool.poetry.extras]
7941
server = ["uvicorn", "fastapi", "sse-starlette"]
42+
43+
[build-system]
44+
requires = [
45+
"setuptools>=42",
46+
"scikit-build>=0.13",
47+
"cmake>=3.18",
48+
"ninja",
49+
]
50+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from skbuild import setup
2+
3+
from pathlib import Path
4+
5+
this_directory = Path(__file__).parent
6+
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
7+
8+
setup(
9+
name="llama_cpp_python",
10+
description="A Python wrapper for llama.cpp",
11+
long_description=long_description,
12+
long_description_content_type="text/markdown",
13+
version="0.1.59",
14+
author="Andrei Betlen",
15+
author_email="[email protected]",
16+
license="MIT",
17+
package_dir={"llama_cpp": "llama_cpp", "llama_cpp.server": "llama_cpp/server"},
18+
packages=["llama_cpp", "llama_cpp.server"],
19+
install_requires=["typing-extensions>=4.5.0", "numpy>=1.20.0", "diskcache>=5.6.1"],
20+
extras_require={
21+
"server": ["uvicorn>=0.21.1", "fastapi>=0.95.0", "sse-starlette>=1.3.3"],
22+
},
23+
python_requires=">=3.7",
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+
)

0 commit comments

Comments
 (0)