|
| 1 | +name: Publish Python SDK to PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "python-sdk-v*" # Trigger on tags like python-sdk-v0.1.0, python-sdk-v1.0.0 |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write # For creating GitHub Releases |
| 10 | + |
| 11 | +jobs: |
| 12 | + test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + defaults: |
| 15 | + run: |
| 16 | + working-directory: packages/python-sdk |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: ["3.10", "3.11", "3.12"] |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Setup Python ${{ matrix.python-version }} |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: ${{ matrix.python-version }} |
| 30 | + |
| 31 | + - name: Setup uv |
| 32 | + uses: astral-sh/setup-uv@v5 |
| 33 | + with: |
| 34 | + enable-cache: true |
| 35 | + cache-dependency-glob: packages/python-sdk/uv.lock |
| 36 | + |
| 37 | + - name: Run tests |
| 38 | + run: uv run --extra dev pytest |
| 39 | + |
| 40 | + - name: Compile package and examples |
| 41 | + run: uv run python -m compileall qveris examples |
| 42 | + |
| 43 | + publish: |
| 44 | + needs: test |
| 45 | + runs-on: ubuntu-latest |
| 46 | + defaults: |
| 47 | + run: |
| 48 | + working-directory: packages/python-sdk |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Setup Python |
| 55 | + uses: actions/setup-python@v5 |
| 56 | + with: |
| 57 | + python-version: "3.11" |
| 58 | + |
| 59 | + - name: Setup uv |
| 60 | + uses: astral-sh/setup-uv@v5 |
| 61 | + with: |
| 62 | + enable-cache: true |
| 63 | + cache-dependency-glob: packages/python-sdk/uv.lock |
| 64 | + |
| 65 | + - name: Verify package version matches tag |
| 66 | + run: | |
| 67 | + TAG_VERSION="${GITHUB_REF_NAME#python-sdk-v}" |
| 68 | + PKG_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") |
| 69 | + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then |
| 70 | + echo "::error::Tag version ($TAG_VERSION) does not match pyproject.toml version ($PKG_VERSION)" |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | + echo "VERSION=$PKG_VERSION" >> "$GITHUB_ENV" |
| 74 | +
|
| 75 | + - name: Build package |
| 76 | + run: uv build |
| 77 | + |
| 78 | + - name: Publish to PyPI |
| 79 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 80 | + with: |
| 81 | + packages-dir: packages/python-sdk/dist |
| 82 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 83 | + |
| 84 | + - name: Create GitHub Release |
| 85 | + uses: softprops/action-gh-release@v2 |
| 86 | + with: |
| 87 | + name: "QVeris Python SDK v${{ env.VERSION }}" |
| 88 | + body: | |
| 89 | + ## Install |
| 90 | +
|
| 91 | + ```bash |
| 92 | + pip install qveris==${{ env.VERSION }} |
| 93 | + ``` |
| 94 | +
|
| 95 | + ## Highlights |
| 96 | +
|
| 97 | + - Publishes the typed Python SDK for the QVeris Agent External Data & Tool Harness. |
| 98 | + - Includes discover, inspect, call, usage, and ledger client methods. |
| 99 | + - Includes the built-in agent runtime and OpenAI-compatible provider support. |
| 100 | +
|
| 101 | + See [README](packages/python-sdk/README.md) for usage. |
| 102 | + generate_release_notes: true |
0 commit comments