Automation foundation model for tiny devices: 2-bit, 8-29 MB, tool calls, ASR, structured extraction and embeddings on phones, wearables, smart homes, robots, cars and microcontrollers.
Update release workflow and version handling for engine compatibility
HenryNdubuakuabb5c2b7b32a
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yamlindex c86c007..237ee03 100644--- a/.github/workflows/release.yaml+++ b/.github/workflows/release.yaml@@ -50,17 +50,49 @@ jobs:if: needs.gate.outputs.run == 'true'runs-on: ubuntu-latestpermissions:+ contents: write # pushes the vX.Y.Z release tagid-token: write # required for PyPI Trusted Publishing (OIDC)steps:- uses: actions/checkout@v4+ with:+ fetch-depth: 0 # tags are needed to derive the next version- uses: actions/setup-python@v5with:python-version: "3.12"- run: pip install build twine- - run: python -m build- - run: twine check dist/*- # Publishes the current pyproject version; if it is already on PyPI (you- # did not bump it this week) it no-ops instead of failing.- - uses: pypa/gh-action-pypi-publish@release/v1+ # The version is not maintained in the repo: each release bumps the patch+ # of the last v* tag (seeded from PyPI when no tags exist yet), patches it+ # into this checkout only, and tags the released commit. If HEAD is+ # already tagged, nothing landed since the last release and we skip.+ # The engine wheel on HF is pinned separately (ENGINE_VERSION in+ # needle/agent/fetch.py), so bumping here never breaks the lib fetch.+ - id: version+ run: |+ last=$(git tag --list 'v*' --sort=-v:refname | head -1)+ if [ -n "$last" ] && [ "$(git rev-parse "$last^{commit}")" = "$(git rev-parse HEAD)" ]; then+ echo "skip=true" >> "$GITHUB_OUTPUT"+ exit 0+ fi+ if [ -z "$last" ]; then+ last="v$(curl -s https://pypi.org/pypi/cactus-needle/json | python3 -c 'import json,sys; print(json.load(sys.stdin)["info"]["version"])')"+ fi+ echo "next=$(echo "${last#v}" | awk -F. '{printf "%d.%d.%d", $1, $2, $3 + 1}')" >> "$GITHUB_OUTPUT"+ - if: steps.version.outputs.skip != 'true'+ run: |+ next="${{ steps.version.outputs.next }}"+ sed -i "s/^version = \".*\"/version = \"$next\"/" pyproject.toml+ sed -i "s/^__version__ = \".*\"/__version__ = \"$next\"/" needle/__init__.py+ - if: steps.version.outputs.skip != 'true'+ run: python -m build+ - if: steps.version.outputs.skip != 'true'+ run: twine check dist/*+ # skip-existing keeps a rerun idempotent if the tag push below ever fails+ # after a successful upload.+ - if: steps.version.outputs.skip != 'true'+ uses: pypa/gh-action-pypi-publish@release/v1with:skip-existing: true+ - if: steps.version.outputs.skip != 'true'+ run: |+ git tag "v${{ steps.version.outputs.next }}"+ git push origin "v${{ steps.version.outputs.next }}"diff --git a/needle/__init__.py b/needle/__init__.pyindex 8cf2a08..48f55fe 100644--- a/needle/__init__.py+++ b/needle/__init__.py@@ -16,12 +16,12 @@ def _library_path():local = os.path.join(here, fetch._lib_name())if os.path.exists(local):return local- cache = os.path.join(os.path.expanduser("~"), ".cache", "cactus-needle", __version__)+ cache = os.path.join(os.path.expanduser("~"), ".cache", "cactus-needle", fetch.ENGINE_VERSION)cached = os.path.join(cache, fetch._lib_name())if os.path.exists(cached):return cachedos.makedirs(cache, exist_ok=True)- return fetch.fetch_library(__version__, cache)+ return fetch.fetch_library(fetch.ENGINE_VERSION, cache)_lib_handle = Nonediff --git a/needle/agent/fetch.py b/needle/agent/fetch.pyindex d1c5957..c860192 100644--- a/needle/agent/fetch.py+++ b/needle/agent/fetch.py@@ -5,6 +5,11 @@ import zipfileHF_REPO = "Cactus-Compute/needle2"+# Names the engine wheel fetched from HF_REPO. Decoupled from the package+# __version__ (which the release workflow bumps every week): bump this only+# when new engine wheels are actually uploaded to HF_REPO.+ENGINE_VERSION = "2.0.0"+def _lib_name():if sys.platform == "darwin":