Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Bug report
description: Report a correctness, performance, or crash issue in snapvec.
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to file a report. A minimal reproducer
and your environment details shorten the feedback loop a lot.

- type: textarea
id: summary
attributes:
label: Summary
description: One or two sentences describing the issue.
validations:
required: true

- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Minimal code that triggers the issue. Include random seeds.
render: python
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected vs actual behaviour
validations:
required: true

- type: input
id: snapvec-version
attributes:
label: snapvec version
placeholder: "0.9.0"
validations:
required: true

- type: input
id: python-version
attributes:
label: Python version
placeholder: "3.12.2"
validations:
required: true

- type: input
id: numpy-version
attributes:
label: NumPy version
placeholder: "1.26.4"

- type: input
id: platform
attributes:
label: OS and CPU
placeholder: "macOS 14.4 arm64 / Ubuntu 22.04 x86_64 / ..."
validations:
required: true

- type: textarea
id: additional
attributes:
label: Additional context
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question or usage help
url: https://github.com/stffns/snapvec/discussions
about: For questions about using snapvec, please use GitHub Discussions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Feature request
description: Propose a new feature or an API change.
labels: ["enhancement"]
body:
- type: textarea
id: problem
attributes:
label: What problem are you trying to solve?
description: A clear description of the use case or limitation.
validations:
required: true

- type: textarea
id: proposal
attributes:
label: Proposed solution
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Alternatives considered

- type: textarea
id: additional
attributes:
label: Additional context
description: Links to papers, related projects, benchmarks, or prior art.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Summary

<!-- One or two sentences: what changes and why. -->

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Performance improvement
- [ ] Refactor
- [ ] Docs / tests only

## Checklist

- [ ] Tests added or updated
- [ ] `ruff check` passes
- [ ] `pytest -q` passes locally
Comment on lines +15 to +17

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR checklist requires ruff format to pass, but the PR description states formatting checks are intentionally omitted because ruff format rewrites the hand-aligned constants in snapvec/_codebooks.py. Please align the PR template with the intended workflow (e.g., drop the ruff format item or exclude the sensitive file so formatting can be required).

Copilot uses AI. Check for mistakes.
- [ ] CHANGELOG updated under `[Unreleased]`
- [ ] On-disk format version bumped if the format changed
- [ ] Benchmark before/after numbers included (for performance PRs)
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5

- package-ecosystem: pip
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5
groups:
dev-dependencies:
patterns:
- "pytest*"
- "mypy*"
- "ruff"
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint (ruff + mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: ruff check
run: ruff check snapvec/ tests/

- name: mypy (strict, warning-only for now)
run: mypy --strict snapvec/ || true

test:
name: Test ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
python-version: ["3.10", "3.12"]
include:
- os: ubuntu-latest
python-version: "3.13"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install libomp (macOS)
if: runner.os == 'macOS'
run: brew install libomp

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run tests
run: pytest -q --cov=snapvec --cov-report=term-missing

- name: Upload coverage (ubuntu + py3.12 only)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: .coverage
if-no-files-found: ignore
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
push:
tags: ["v*"]
workflow_dispatch:

jobs:
build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: ubuntu-24.04-arm
cibw_archs: "aarch64"
- os: macos-13
cibw_archs: "x86_64"
- os: macos-14
cibw_archs: "arm64"
- os: windows-latest
cibw_archs: "AMD64"
steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/cibuildwheel@v2.22
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_SKIP: "*-musllinux_* pp*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BEFORE_ALL_MACOS: "brew install libomp"
CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=13.0"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {project}/tests -q"

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl

build_sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build sdist
run: |
python -m pip install --upgrade pip build
python -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/project/snapvec/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Publish via trusted publishing
uses: pypa/gh-action-pypi-publish@release/v1
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ["--maxkb=500"]
- id: check-merge-conflict
- id: mixed-line-ending
args: ["--fix=lf"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix"]
32 changes: 32 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# snapvec -- Claude-specific instructions

## Commits
- NEVER add `Co-Authored-By` lines to commit messages.
- Use conventional prefixes: `feat`, `fix`, `chore`, `docs`, `bench`, `refactor`, `test`.
- Keep subject under 72 chars. Present-tense imperative.

## Code style
- Prefer ASCII in new or edited text (source, docstrings, docs, commits).
No em dashes, no smart quotes, no ellipsis character. Use `-`, `--`,
`"`, `'`, `...`. Existing math notation in docstrings (`sqrt`, arrows,
inner-product brackets) may remain unless you are already rewriting
that block.
- English everywhere in code, docstrings, commits, and README.

## Project layout
- `snapvec/` = library (public API in `__init__.py`).
- `tests/` = pytest suite (151 tests as of v0.9.0).
- `experiments/` = rough benchmarks and profiling scripts -- do not treat as first-class code.
- `bench/` (future) = reproducible benchmark suite that runs in CI.

## Running checks locally
```bash
ruff check snapvec/ tests/
pytest -q
mypy --strict snapvec/ # 17 errors as of 2026-04-20, warning-only in CI
```

## File format invariants
- Any change to the on-disk format (`.snpv`, `.snpq`, `.snpr`, `.snpi`) must bump
the format version in `snapvec/_file_format.py` and add a round-trip test.
- Do not remove or reorder existing serialized fields without a migration path.
31 changes: 31 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone.

## Our Standards

Examples of behavior that contributes to a positive environment:
- Using welcoming and inclusive language.
- Being respectful of differing viewpoints and experiences.
- Gracefully accepting constructive criticism.
- Focusing on what is best for the community.

Examples of unacceptable behavior:
- The use of sexualized language or imagery and unwelcome sexual attention.
- Trolling, insulting or derogatory comments, and personal or political attacks.
- Public or private harassment.
- Publishing others' private information without explicit permission.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project maintainer at **stffens@gmail.com**. All
complaints will be reviewed and investigated promptly and fairly.

## Attribution

This Code of Conduct is adapted from the
[Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
Loading
Loading