From 5888f9d62d21d01d7fb0b19b7fdd6e6db525e83c Mon Sep 17 00:00:00 2001 From: Andres Marafioti Date: Wed, 24 Jun 2026 16:34:33 +0200 Subject: [PATCH 1/2] Add PyPI publishing workflow --- .github/workflows/publish.yml | 141 ++++++++++++++++++++++++++++++++++ AGENTS.md | 35 +++++++++ 2 files changed, 176 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 AGENTS.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6e60668 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,141 @@ +name: Publish + +"on": + push: + tags: + - "v*" + workflow_dispatch: + inputs: + qwentts_ref: + description: qwentts.cpp commit, tag, or branch to build + required: true + default: 4536dcdce27c3764a93a06d6bf64026b124962f5 + +permissions: + contents: read + +jobs: + build-wheels: + name: Linux ${{ matrix.arch }} CUDA 12.8 wheel + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + include: + - arch: x86_64 + runner: hf-jobs-cpu-performance + cuda_repo_arch: x86_64 + cuda_package_suffix: "12-8" + cuda_home: /usr/local/cuda-12.8 + cuda_architectures: 75-virtual;80-virtual;86-real;89-real;90-real;100-real;120-real;120-virtual + build_jobs: "16" + - arch: aarch64 + runner: ubuntu-24.04-arm + cuda_repo_arch: sbsa + cuda_package_suffix: "12-8" + cuda_home: /usr/local/cuda-12.8 + cuda_architectures: 75-virtual;80-virtual;86-real;89-real;90-real;100-real;120-real;120-virtual + build_jobs: "2" + env: + QWENTTS_CPP_BACKEND: cuda + QWENTTS_CPP_BUILD_JOBS: ${{ matrix.build_jobs }} + QWENTTS_CPP_WHEEL_BUILD_TAG: 1cu128 + QWENTTS_REF: ${{ inputs.qwentts_ref || '4536dcdce27c3764a93a06d6bf64026b124962f5' }} + CUDA_ARCHITECTURES: ${{ matrix.cuda_architectures }} + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Free disk space + run: | + sudo rm -rf /usr/local/lib/android /opt/ghc /usr/share/dotnet + sudo apt-get clean + + - name: Install build tools + run: | + python -m pip install --upgrade pip build wheel + sudo apt-get update + sudo apt-get install -y --no-install-recommends cmake ninja-build patchelf wget ca-certificates + + - name: Install CUDA toolkit + run: | + wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/${{ matrix.cuda_repo_arch }}/cuda-keyring_1.1-1_all.deb + sudo dpkg -i cuda-keyring_1.1-1_all.deb + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + cuda-nvcc-${{ matrix.cuda_package_suffix }} \ + cuda-cudart-dev-${{ matrix.cuda_package_suffix }} \ + libcublas-dev-${{ matrix.cuda_package_suffix }} + echo "${{ matrix.cuda_home }}/bin" >> "$GITHUB_PATH" + echo "CUDA_HOME=${{ matrix.cuda_home }}" >> "$GITHUB_ENV" + echo "CMAKE_CUDA_COMPILER=${{ matrix.cuda_home }}/bin/nvcc" >> "$GITHUB_ENV" + + - name: Fetch qwentts.cpp + run: | + git clone --recursive https://github.com/ServeurpersoCom/qwentts.cpp third_party/qwentts.cpp + git -C third_party/qwentts.cpp checkout "$QWENTTS_REF" + git -C third_party/qwentts.cpp submodule update --init --recursive + + - name: Build wheel + run: | + python scripts/build_native.py \ + --source third_party/qwentts.cpp \ + --backend cuda \ + --clean \ + --cmake-arg=-G \ + --cmake-arg=Ninja \ + --cmake-arg="-DCMAKE_CUDA_ARCHITECTURES=$CUDA_ARCHITECTURES" + python -m build --wheel + mkdir -p wheelhouse + cp dist/*.whl wheelhouse/ + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: wheel-${{ matrix.arch }} + path: wheelhouse/*.whl + + check: + name: Check distributions + needs: build-wheels + runs-on: ubuntu-latest + steps: + - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + with: + version: "latest" + enable-cache: false + + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + pattern: wheel-* + path: dist + merge-multiple: true + + - name: Check package metadata + run: uvx twine check --strict dist/* + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: dist + path: dist/* + + publish: + needs: check + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/qwentts-cpp-python/ + permissions: + contents: read + id-token: write + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: dist + path: dist + + - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..81e5071 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,35 @@ +# Repository Instructions + +- Never include `codex` in branch names or pull request titles. +- Keep release pull requests focused on version metadata and release documentation. +- Do not commit local build artifacts such as `dist/`, `build/`, generated wheels, generated sdists, or copied shared libraries. + +## Publishing to PyPI + +PyPI publishing is handled by GitHub Actions in `.github/workflows/publish.yml`. +The workflow runs on pushed tags that match `v*`, builds the public Linux CUDA +12.8 wheels, checks the artifacts with `twine check --strict`, and publishes +through the configured `pypi` environment. + +The public `qwentts-cpp-python` package currently publishes CUDA 12.8 wheels +only. CPU and CUDA 13 wheels are useful validation artifacts, but publishing +multiple backend flavors under the same package name, version, and platform tag +would leave pip with no reliable way to choose the intended runtime. + +To prepare a release: + +1. Confirm the intended version is not already published on PyPI. +2. Bump `version` in `pyproject.toml`. +3. Bump `__version__` in `src/qwentts_cpp/__init__.py`. +4. Open and merge a pull request with only the release preparation changes. + +To publish after the release PR is merged: + +1. Update `main` locally: `git checkout main && git pull origin main`. +2. Create an annotated tag for the version: `git tag -a vX.Y.Z -m "Release vX.Y.Z"`. +3. Push the tag: `git push origin vX.Y.Z`. +4. Watch the `Publish` GitHub Actions workflow complete successfully. +5. Verify the new version appears at `https://pypi.org/project/qwentts-cpp-python/`. + +Only upload manually if the GitHub Actions workflow is unavailable and the +maintainers have explicitly chosen that fallback. From 6511953d26011e0bd31f4e484b68384f21f67b54 Mon Sep 17 00:00:00 2001 From: Andres Marafioti Date: Wed, 24 Jun 2026 16:42:57 +0200 Subject: [PATCH 2/2] Prepare 0.2.0 release --- pyproject.toml | 2 +- src/qwentts_cpp/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7e42dd..30c83e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qwentts-cpp-python" -version = "0.1.0a1" +version = "0.2.0" description = "Python ctypes bindings and wheel packaging for qwentts.cpp" readme = "README.md" license = "MIT" diff --git a/src/qwentts_cpp/__init__.py b/src/qwentts_cpp/__init__.py index fdb1743..0b573a6 100644 --- a/src/qwentts_cpp/__init__.py +++ b/src/qwentts_cpp/__init__.py @@ -11,7 +11,7 @@ ) from .models import GGUF_REPO, resolve_gguf_paths -__version__ = "0.1.0a1" +__version__ = "0.2.0" __all__ = [ "GGUF_REPO",