Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Native examples

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: tests-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
test:
name: ${{ matrix.os }} / Python ${{ matrix.python }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11", "3.12", "3.13", "3.14", "3.15"]
include:
- os: macos-latest
python: "3.15"
- os: windows-latest
python: "3.15"
runs-on: ${{ matrix.os }}
timeout-minutes: 25
env:
UV_PYTHON: ${{ matrix.python }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
version: "0.13.13"
- name: Install zlib headers on Linux
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev
- name: Install static zlib for MSVC
if: runner.os == 'Windows'
shell: pwsh
run: |
vcpkg install zlib:x64-windows-static-md --classic
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
"CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
"CMAKE_ARGS=-DVCPKG_TARGET_TRIPLET=x64-windows-static-md" >> $env:GITHUB_ENV
- name: Build and test the installed examples
run: uv run --locked --no-default-groups --group test pytest
- name: Smoke-test the benchmark
run: uv run --locked --no-default-groups --group test python -m comparison.benchmark --calls 100 --repeat 1

quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
version: "0.13.13"
- run: uv lock --check
- run: uv sync --locked --only-group quality
- name: Run prek checks and Markdown formatting
run: uv run --locked --no-sync prek run --all-files --show-diff-on-failure
52 changes: 52 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Documentation

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
with:
version: "0.13.13"
- run: make docs-test
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site/

deploy:
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
concurrency:
group: github-pages
cancel-in-progress: false
# A late build must not displace a newer commit already waiting to deploy.
queue: max
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Read the current main commit after acquiring the deployment slot
id: main
env:
GH_TOKEN: ${{ github.token }}
run: |
sha=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq '.object.sha')
echo "sha=$sha" >> "$GITHUB_OUTPUT"
- name: Deploy the guide
if: steps.main.outputs.sha == github.sha
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
101 changes: 9 additions & 92 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,99 +1,16 @@
# Byte-compiled / optimized / DLL files
.venv/
.env
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.egg-info/
*.so

# Distribution / packaging
.Python
env/
*.pyd
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Mac OS X
site/
.cache/
.pytest_cache/
.ruff_cache/
.DS_Store

# IntelliJ IDEs such as PyCharm
.idea

# Pipenv
Pipfile.lock
.venv
.idea/
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: local
hooks:
- id: ruff-check
name: Ruff lint
language: system
entry: uv run --locked --no-sync ruff check
types: [python]
- id: ruff-format
name: Ruff format
language: system
entry: uv run --locked --no-sync ruff format --check
types: [python]
- id: rustfmt
name: Rust format
language: system
entry: cargo fmt --manifest-path rust/Cargo.toml -- --check
types: [rust]
pass_filenames: false
- id: prettier
name: Format Markdown with Prettier
language: node
additional_dependencies: [prettier@3.10.2]
entry: prettier --write
types: [markdown]
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"proseWrap": "always",
"tabWidth": 4
}
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.15
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.DEFAULT_GOAL := help
.PHONY: help install hooks check test benchmark docs docs-test

help:
@echo 'make install Install both native packages and development tools'
@echo 'make hooks Install the prek Git hook'
@echo 'make check Check the lockfile and run prek on all files'
@echo 'make test Build the bindings and run the shared test suite'
@echo 'make benchmark Compare the implementations on this machine'
@echo 'make docs Preview the Zensical guide locally'
@echo 'make docs-test Build the guide with strict validation'

install:
uv sync --locked

hooks: install
uv run --locked --no-sync prek install

check: install
uv lock --check
uv run --locked --no-sync prek run --all-files

test:
uv run --locked python -m pytest

benchmark:
uv run --locked python -m comparison.benchmark

docs:
uv run --isolated --locked --only-group docs zensical serve -o

docs-test:
uv run --isolated --locked --only-group docs zensical build --strict
12 changes: 0 additions & 12 deletions Pipfile

This file was deleted.

Loading
Loading