Minimal pycapnp

This commit is contained in:
Adeeb Shihadeh
2026-09-21 18:57:37 -07:00
parent a0cb5cdf06
commit 5befba15f3
125 changed files with 423 additions and 14793 deletions

View File

@@ -1,66 +0,0 @@
name: Docs
on:
push:
branches: [master, main]
tags:
- 'v*'
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install project and dependencies
run: |
# This replaces requirements.txt, setup.py build, and pip install .
# It reads pyproject.toml, builds pycapnp, and installs it into a fast .venv
uv sync --all-extras
- name: Build documentation
run: |
# uv run executes sphinx within the isolated virtual environment
uv run sphinx-build docs build/html
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: html-docs
path: build/html
deploy:
needs: docs
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download documentation artifact
uses: actions/download-artifact@v4
with:
name: html-docs
path: build/html
- name: Add .nojekyll file
run: touch build/html/.nojekyll
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/html
publish_branch: gh-pages

View File

@@ -3,135 +3,48 @@ name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
wheels:
strategy:
max-parallel: 99
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
- os: ubuntu-latest
arch: i686
# Native ARM runner — no QEMU, drastically faster than emulated aarch64
- os: ubuntu-24.04-arm
arch: aarch64
- os: macos-15
arch: x86_64
- os: macos-15
arch: arm64
# Disabled until someone figures out how to build capnproto for arm64 and x86_64 simultaneously
# - os: macOS-latest
# arch: universal2
- os: windows-2022
arch: AMD64
- os: windows-2022
arch: x86
# Does not build currently
# - os: windows-2019
# arch: ARM64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
with:
output-dir: wheelhouse
- uses: pypa/cibuildwheel@v3.4.1
env:
CIBW_BUILD: cp312-*
CIBW_ARCHS: ${{ matrix.arch }}
# Drop EOL CPython 3.8 (also avoids the macOS x86_64-only-installer warning)
CIBW_SKIP: "cp38-*"
CIBW_TEST_REQUIRES: pytest pytest-asyncio
CIBW_TEST_COMMAND: pytest {project}
# Force libcapnp to build for the target arch on macOS (the runner
# is arm64, so without this an x86_64 wheel ends up linking against
# an arm64 libkj/libcapnp and failing to load at test time).
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: python -m pytest {project}/test
CIBW_CONFIG_SETTINGS: force-bundled-libcapnp=true
CMAKE_OSX_ARCHITECTURES: "${{ runner.os == 'macOS' && matrix.arch || '' }}"
- uses: actions/upload-artifact@v6
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
name: wheels-${{ matrix.arch }}-${{ matrix.os }}
path: wheelhouse/*.whl
# Exotic arches built via QEMU emulation — very slow (often >1h), so only run
# on release tags rather than every push/PR.
build_wheels_exotic:
name: Build wheels (exotic) ${{ matrix.arch }}
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [ppc64le, s390x]
steps:
- uses: actions/checkout@v5
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
with:
output-dir: wheelhouse
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_SKIP: "cp38-*"
# Tests under QEMU are extremely slow; skip them for these arches.
CIBW_TEST_SKIP: "*"
- uses: actions/upload-artifact@v6
with:
name: cibw-wheels-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build sdist
run: pipx run build --sdist
- uses: astral-sh/setup-uv@v3
- run: uv build --sdist
- uses: actions/upload-artifact@v6
with:
name: cibw-sdist
name: sdist
path: dist/*.tar.gz
lint:
name: Lint and format with ruff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Lint and format with ruff
run: |
pip install --upgrade pip
pip install --group lint
ruff check .
ruff format --check .
# upload_pypi:
# needs: [build_wheels, build_sdist]
# runs-on: ubuntu-latest
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# steps:
# - uses: actions/download-artifact@v3
# with:
# # unpacks default artifact into dist/
# # if `name: artifact` is omitted, the action will create extra parent dir
# name: artifact
# path: dist
# - uses: pypa/gh-action-pypi-publish@v1.5.0
# with:
# user: __token__
# password: ${{ secrets.PYPI_PASSWORD_RELEASE }}
# # password: ${{ secrets.PYPI_PASSWORD }}
# # repository_url: https://test.pypi.org/legacy/
- uses: astral-sh/setup-uv@v3
- run: uvx ruff@0.16.8 check .
- run: uvx ruff@0.16.8 format --check .