diff --git a/.github/workflows/_package-publish.yml b/.github/workflows/_package-publish.yml index 1b4ddd29e..f1f6a9ac1 100644 --- a/.github/workflows/_package-publish.yml +++ b/.github/workflows/_package-publish.yml @@ -171,17 +171,36 @@ jobs: GIT_CLIFF_CHANGELOG: ${{ steps.git-cliff.outputs.changelog }} run: cat "$GIT_CLIFF_CHANGELOG" - - name: Build distribution into dist/ + - name: Verify lockstep versioning shell: bash - run: make dist + run: | + SDK_VERSION=$(grep '^version = ' packages/aignostics-sdk/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/') + FULL_VERSION=$(grep '^version = ' packages/aignostics/pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/') + if [ "$SDK_VERSION" != "$FULL_VERSION" ]; then + echo "❌ Version mismatch: aignostics-sdk=$SDK_VERSION, aignostics=$FULL_VERSION" + exit 1 + fi + echo "✅ Versions match: $SDK_VERSION" - - name: Publish distribution to Python Package Index at pypi.org + - name: Build aignostics-sdk distribution + shell: bash + run: uv build --package aignostics-sdk --out-dir dist/ + + - name: Publish aignostics-sdk to PyPI shell: bash env: UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }} - run: | - # Use uv's credential storage - uv will read from UV_PUBLISH_TOKEN env var automatically - uv publish + run: uv publish dist/aignostics_sdk-* + + - name: Build aignostics distribution + shell: bash + run: uv build --package aignostics --out-dir dist/ + + - name: Publish aignostics to PyPI + shell: bash + env: + UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }} + run: uv publish dist/aignostics-* - name: Download test results for ubuntu-latest generated in _test.yml if: | @@ -276,3 +295,25 @@ jobs: # See https://github.com/cli/cli/discussions/10696 gh api repos/aignostics/python-sdk/dispatches \ -f event_type=release_created_programatically + + smoke_test_slim: + runs-on: ubuntu-latest + needs: package_publish + continue-on-error: true + steps: + - name: Install uv + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 + + - name: Smoke test aignostics-sdk + shell: bash + run: | + VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//') + uv venv /tmp/slim-venv + uv pip install --python /tmp/slim-venv/bin/python "aignostics-sdk==$VERSION" + /tmp/slim-venv/bin/aignostics-sdk --help + /tmp/slim-venv/bin/python -c "from aignostics_sdk.platform import Client; print('✅ slim import OK')" + if /tmp/slim-venv/bin/python -c "import openslide" 2>/dev/null; then + echo "❌ openslide should not be installed in slim package" + exit 1 + fi + echo "✅ Heavy deps correctly absent" diff --git a/noxfile.py b/noxfile.py index dd69ce240..8d74238e4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1027,5 +1027,6 @@ def act(session: nox.Session) -> None: @nox.session() def dist(session: nox.Session) -> None: - """Build wheel and put in dist/.""" - session.run("uv", "build", external=True) + """Build wheels for both packages into dist/.""" + session.run("uv", "build", "--package", "aignostics-sdk", "--out-dir", "dist/", external=True) + session.run("uv", "build", "--package", "aignostics", "--out-dir", "dist/", external=True)