diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b92afbd4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]*' + +jobs: + + tests: + uses: ./.github/workflows/test.yml + + build: + needs: [tests] + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + if: matrix.os == 'ubuntu-latest' + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.15.0 + - name: Build wheels + run: python -m cibuildwheel --output-dir dist + env: + HNSWLIB_NO_NATIVE: true + CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7" + CIBW_SKIP: "cp312-* pp* *musllinux*" + CIBW_ARCHS_MACOS: "x86_64 arm64" + CIBW_ARCHS_WINDOWS: "AMD64" + CIBW_ARCHS_LINUX: "x86_64 aarch64" + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist + + upload: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Build sdist + run: | + python -m pip install . + make dist + - name: Download wheels + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - 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/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 94% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index 20e935fd..9674abb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,13 @@ -name: HNSW CI +name: Test -on: [push, pull_request] +on: + workflow_call: + push: + branches: + - master + pull_request: + branches: + - master jobs: test_python: diff --git a/.gitignore b/.gitignore index 48f74604..0fe59275 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ var/ .vscode/ .vs/ **.DS_Store +*.egg-info/ +venv/ \ No newline at end of file diff --git a/README.md b/README.md index a1c85512..b398ae06 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,34 @@ # Chroma-Hnswlib - fast approximate nearest neighbor search -Chromas fork of https://github.com/nmslib/hnswlib \ No newline at end of file +Chromas fork of https://github.com/nmslib/hnswlib + +## Build & Release + +Wheels are automatically built and pushed to PyPI for multiple +platforms via GitHub actions using the +[cibuildwheel](https://github.com/pypa/cibuildwheel). + +The `Publish` Github Action is configured to run whenever a version +tag (a tag string with three period-delimited numbers) is pushed. Is +is necessary to ensure that the version number in `setup.py` has also +been updated, or else the `Publish` action will fail. + +### Building AVX Extensions + +For maximum compatibility, the distributed wheels are not compiled to +make use of Advanced Vector Extensions (AVX). If your hardware +supports AVX, you may get better performance by recompiling this +library on the machine on which it is intended to run. + +To force recompilation when installing, specify the `--no-binary +chroma-hsnwlib` option to PIP when installing dependencies. This can +be added to your `pip install` command, for example: + +``` +pip install -r requirements.txt --no-binary chroma-hnswlib +``` + +You can also put the `--no-binary` directive [in your requirements.txt](https://pip.pypa.io/en/stable/cli/pip_install/#install-no-binary). + +If you've already installed dependencies, you must first uninstall +`chroma-hsnwlib` using `pip uninstall chroma-hnswlib` to remove the +precompiled version before reinstalling. diff --git a/setup.py b/setup.py index 19e97672..23bd4fd6 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from setuptools import Extension, setup from setuptools.command.build_ext import build_ext -__version__ = '0.7.2' +__version__ = '0.7.3.alpha7' include_dirs = [ pybind11.get_include(),