Skip to content

Commit

Permalink
Merge pull request chroma-core#9 from chroma-core/lukev/wheels
Browse files Browse the repository at this point in the history
Include binary wheels in release
  • Loading branch information
HammadB authored Sep 6, 2023
2 parents 4ba0ecb + 69f062b commit 409b1d5
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 4 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 9 additions & 2 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ var/
.vscode/
.vs/
**.DS_Store
*.egg-info/
venv/
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# Chroma-Hnswlib - fast approximate nearest neighbor search
Chromas fork of https://github.com/nmslib/hnswlib
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.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 409b1d5

Please sign in to comment.