Revert "Merge pull request #350 from abetlen/migrate-to-scikit-build-core"
This reverts commitfb2c5f7fd9
, reversing changes made to202ed4464b
.
This commit is contained in:
parent
3c6e1b6c42
commit
e3542b6627
10 changed files with 149 additions and 86 deletions
12
.github/workflows/build-and-release.yaml
vendored
12
.github/workflows/build-and-release.yaml
vendored
|
@ -22,15 +22,14 @@ jobs:
|
||||||
- uses: actions/setup-python@v3
|
- uses: actions/setup-python@v3
|
||||||
|
|
||||||
- name: Install cibuildwheel
|
- name: Install cibuildwheel
|
||||||
run: python3 -m pip install cibuildwheel==2.12.1
|
run: python -m pip install cibuildwheel==2.12.1
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
|
||||||
python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
run: python3 -m cibuildwheel --output-dir wheelhouse
|
run: python -m cibuildwheel --output-dir wheelhouse
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
@ -47,11 +46,10 @@ jobs:
|
||||||
- uses: actions/setup-python@v3
|
- uses: actions/setup-python@v3
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip build
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
|
||||||
python3 -m pip install --verbose --editable .
|
|
||||||
- name: Build source distribution
|
- name: Build source distribution
|
||||||
run: |
|
run: |
|
||||||
python3 -m build --sdist
|
python setup.py sdist
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ./dist/*.tar.gz
|
path: ./dist/*.tar.gz
|
||||||
|
|
39
.github/workflows/build-docker.yaml
vendored
Normal file
39
.github/workflows/build-docker.yaml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
name: Build Docker
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
name: Build and push Docker image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: "true"
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true # push to registry
|
||||||
|
pull: true # always fetch the latest base images
|
||||||
|
platforms: linux/amd64,linux/arm64 # build for both amd64 and arm64
|
||||||
|
tags: ghcr.io/abetlen/llama-cpp-python:latest
|
30
.github/workflows/publish-to-test.yaml
vendored
Normal file
30
.github/workflows/publish-to-test.yaml
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Based on: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
|
||||||
|
|
||||||
|
name: Publish to TestPyPI
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-n-publish:
|
||||||
|
name: Build and publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: "true"
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.8"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
|
||||||
|
- name: Build source distribution
|
||||||
|
run: |
|
||||||
|
python setup.py sdist
|
||||||
|
- name: Publish to Test PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||||
|
repository-url: https://test.pypi.org/legacy/
|
4
.github/workflows/publish.yaml
vendored
4
.github/workflows/publish.yaml
vendored
|
@ -19,10 +19,10 @@ jobs:
|
||||||
python-version: "3.8"
|
python-version: "3.8"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip build
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools
|
||||||
- name: Build source distribution
|
- name: Build source distribution
|
||||||
run: |
|
run: |
|
||||||
python3 -m build --sdist
|
python setup.py sdist
|
||||||
- name: Publish distribution to PyPI
|
- name: Publish distribution to PyPI
|
||||||
# TODO: move to tag based releases
|
# TODO: move to tag based releases
|
||||||
# if: startsWith(github.ref, 'refs/tags')
|
# if: startsWith(github.ref, 'refs/tags')
|
||||||
|
|
18
.github/workflows/test.yaml
vendored
18
.github/workflows/test.yaml
vendored
|
@ -26,11 +26,11 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
|
||||||
python3 -m pip install --verbose --editable .[server,test]
|
pip install . -v
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
python3 -m pytest
|
pytest
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
|
|
||||||
|
@ -49,11 +49,11 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
|
||||||
python3 -m pip install --verbose --editable .[server,test]
|
pip install . -v
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
python3 -m pytest
|
pytest
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi sse-starlette httpx uvicorn
|
||||||
python3 -m pip install --verbose --editable .[server,test]
|
pip install . -v
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
python3 -m pytest
|
pytest
|
|
@ -9,9 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [0.1.60]
|
## [0.1.60]
|
||||||
|
|
||||||
#### Addeed
|
### NOTE
|
||||||
|
|
||||||
- (build-system) Migrate from scikit-build to scikit-build-core
|
- This release was deleted due to a bug with the packaging system that caused pip installations to fail.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
@ -18,16 +18,16 @@ if (UNIX AND NOT FORCE_CMAKE)
|
||||||
)
|
)
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
|
FILES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp/libllama.so
|
||||||
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
DESTINATION llama_cpp
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(BUILD_SHARED_LIBS "On")
|
set(BUILD_SHARED_LIBS "On")
|
||||||
add_subdirectory(vendor/llama.cpp)
|
add_subdirectory(vendor/llama.cpp)
|
||||||
install(
|
install(
|
||||||
TARGETS llama
|
TARGETS llama
|
||||||
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
LIBRARY DESTINATION llama_cpp
|
||||||
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
RUNTIME DESTINATION llama_cpp
|
||||||
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
ARCHIVE DESTINATION llama_cpp
|
||||||
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/llama_cpp
|
FRAMEWORK DESTINATION llama_cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
23
Makefile
23
Makefile
|
@ -1,38 +1,30 @@
|
||||||
update:
|
update:
|
||||||
poetry install
|
poetry install
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
update.vendor:
|
update.vendor:
|
||||||
cd vendor/llama.cpp && git pull origin master
|
cd vendor/llama.cpp && git pull origin master
|
||||||
|
|
||||||
build:
|
build:
|
||||||
python3 -m pip install --upgrade pip
|
python3 setup.py develop
|
||||||
python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.cuda:
|
build.cuda:
|
||||||
python3 -m pip install --upgrade pip
|
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 python3 setup.py develop
|
||||||
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.opencl:
|
build.opencl:
|
||||||
python3 -m pip install --upgrade pip
|
CMAKE_ARGS="-DLLAMA_CLBLAST=on" FORCE_CMAKE=1 python3 setup.py develop
|
||||||
CMAKE_ARGS="-DLLAMA_CLBLAST=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.openblas:
|
build.openblas:
|
||||||
python3 -m pip install --upgrade pip
|
CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 python3 setup.py develop
|
||||||
CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.blis:
|
build.blis:
|
||||||
python3 -m pip install --upgrade pip
|
CMAKE_ARGS="-DLLAMA_OPENBLAS=on -DLLAMA_OPENBLAS_VENDOR=blis" FORCE_CMAKE=1 python3 setup.py develop
|
||||||
CMAKE_ARGS="-DLLAMA_OPENBLAS=on -DLLAMA_OPENBLAS_VENDOR=blis" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.metal:
|
build.metal:
|
||||||
python3 -m pip install --upgrade pip
|
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 python3 setup.py develop
|
||||||
CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 python3 -m pip install --verbose --editable .
|
|
||||||
|
|
||||||
build.sdist:
|
build.sdist:
|
||||||
python3 -m pip install --upgrade pip build
|
python3 setup.py sdist
|
||||||
python3 -m build --sdist
|
|
||||||
|
|
||||||
deploy.pypi:
|
deploy.pypi:
|
||||||
python3 -m twine upload dist/*
|
python3 -m twine upload dist/*
|
||||||
|
@ -44,6 +36,7 @@ deploy.gh-docs:
|
||||||
clean:
|
clean:
|
||||||
- cd vendor/llama.cpp && make clean
|
- cd vendor/llama.cpp && make clean
|
||||||
- cd vendor/llama.cpp && rm libllama.so
|
- cd vendor/llama.cpp && rm libllama.so
|
||||||
|
- rm -rf _skbuild
|
||||||
- rm llama_cpp/*.so
|
- rm llama_cpp/*.so
|
||||||
- rm llama_cpp/*.dylib
|
- rm llama_cpp/*.dylib
|
||||||
- rm llama_cpp/*.dll
|
- rm llama_cpp/*.dll
|
||||||
|
|
|
@ -1,54 +1,16 @@
|
||||||
[build-system]
|
[tool.poetry]
|
||||||
requires = [
|
|
||||||
"scikit-build-core>=0.4.4",
|
|
||||||
"cmake>=3.18",
|
|
||||||
"ninja",
|
|
||||||
]
|
|
||||||
build-backend = "scikit_build_core.build"
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "llama_cpp_python"
|
name = "llama_cpp_python"
|
||||||
version = "0.1.60"
|
version = "0.1.60"
|
||||||
description = "Python bindings for the llama.cpp library"
|
description = "Python bindings for the llama.cpp library"
|
||||||
|
authors = ["Andrei Betlen <abetlen@gmail.com>"]
|
||||||
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "MIT" }
|
homepage = "https://github.com/abetlen/llama-cpp-python"
|
||||||
authors = [
|
repository = "https://github.com/abetlen/llama-cpp-python"
|
||||||
{ name = "Andrei Betlen", email = "abetlen@gmail.com" },
|
packages = [{include = "llama_cpp"}]
|
||||||
|
include = [
|
||||||
|
"LICENSE.md",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.7"
|
|
||||||
dependencies = [
|
|
||||||
"typing-extensions>=4.5.0",
|
|
||||||
"numpy>=1.20.0",
|
|
||||||
"diskcache>=5.6.1",
|
|
||||||
]
|
|
||||||
classifiers = [
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Programming Language :: Python :: 3.7",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Homepage = "https://github.com/abetlen/llama-cpp-python"
|
|
||||||
Documentation = "https://abetlen.github.io/llama-cpp-python"
|
|
||||||
Discussions = "https://github.com/abetlen/llama-cpp-python/discussions"
|
|
||||||
Issues = "https://github.com/abetlen/llama-cpp-python/issues"
|
|
||||||
Changelog = "https://github.com/abetlen/llama-cpp-python/blob/main/CHANGELOG.md"
|
|
||||||
|
|
||||||
[tool.scikit-build]
|
|
||||||
wheel.packages = ["llama_cpp", "llama_cpp.server"]
|
|
||||||
wheel.expand-macos-universal-tags = true
|
|
||||||
cmake.verbose = true
|
|
||||||
|
|
||||||
[project.optional-dependencies]
|
|
||||||
server = [
|
|
||||||
"uvicorn",
|
|
||||||
"fastapi",
|
|
||||||
"sse-starlette",
|
|
||||||
]
|
|
||||||
test = ["pytest", "httpx"]
|
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "llama_cpp_python"
|
name = "llama_cpp_python"
|
||||||
|
@ -77,3 +39,12 @@ scikit-build = "0.17.6"
|
||||||
|
|
||||||
[tool.poetry.extras]
|
[tool.poetry.extras]
|
||||||
server = ["uvicorn", "fastapi", "sse-starlette"]
|
server = ["uvicorn", "fastapi", "sse-starlette"]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = [
|
||||||
|
"setuptools>=42",
|
||||||
|
"scikit-build>=0.13",
|
||||||
|
"cmake>=3.18",
|
||||||
|
"ninja",
|
||||||
|
]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
32
setup.py
Normal file
32
setup.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
from skbuild import setup
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
this_directory = Path(__file__).parent
|
||||||
|
long_description = (this_directory / "README.md").read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="llama_cpp_python",
|
||||||
|
description="A Python wrapper for llama.cpp",
|
||||||
|
long_description=long_description,
|
||||||
|
long_description_content_type="text/markdown",
|
||||||
|
version="0.1.59",
|
||||||
|
author="Andrei Betlen",
|
||||||
|
author_email="abetlen@gmail.com",
|
||||||
|
license="MIT",
|
||||||
|
package_dir={"llama_cpp": "llama_cpp", "llama_cpp.server": "llama_cpp/server"},
|
||||||
|
packages=["llama_cpp", "llama_cpp.server"],
|
||||||
|
install_requires=["typing-extensions>=4.5.0", "numpy>=1.20.0", "diskcache>=5.6.1"],
|
||||||
|
extras_require={
|
||||||
|
"server": ["uvicorn>=0.21.1", "fastapi>=0.95.0", "sse-starlette>=1.3.3"],
|
||||||
|
},
|
||||||
|
python_requires=">=3.7",
|
||||||
|
classifiers=[
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.7",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
],
|
||||||
|
)
|
Loading…
Reference in a new issue