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
37 changes: 37 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# <!-- Title -->

## Description

<!-- What does this PR do? Why is it needed? -->

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Refactor (no functional changes)
- [ ] CI/build configuration

## Related Issues

<!-- Link any related issues: Fixes #123, Closes #456 -->

## Checklist

- [ ] Code follows the project style (`black`, `isort`, `ruff check`)
- [ ] Type checking passes (`uv run ty check`)
- [ ] All new and existing tests pass (`uv run pytest`)
- [ ] Coverage remains ≥ 90%
- [ ] Docstrings added/updated (reStructuredText/Sphinx format)
- [ ] `from __future__ import annotations` included in new modules
- [ ] No new dependencies added (or justified if added)
- [ ] Pre-commit hooks pass (`pre-commit run --all-files`)

## Testing

<!-- How was this tested? Any new test cases? -->

## Additional Notes

<!-- Anything reviewers should know? -->
50 changes: 18 additions & 32 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,25 @@ on:
push:
tags:
- 'v*.*.*'
# workflow_run doesn't appear to be able to combine with publishing on tags
#workflow_run:
# workflows: [ "CI" ]
# types: [ completed ]

jobs:
release:
publish:
runs-on: ubuntu-latest
# TODO: only run this if the CI job succeeds and there is a tag set
#if: github.event.workflow_run.conclusion == 'success'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy:
matrix:
python-version:
- 3.9
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -y install graphviz
python -m pip install --upgrade pip
pip install wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build package
run: |
python -m build
twine check dist/*
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v5
with:
version: ">=0.10.12"
- name: Build package
run: uv build
- name: Check package
run: uv run --with twine twine check dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
81 changes: 52 additions & 29 deletions .github/workflows/python-package-ci.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,68 @@
# This workflow will install Python dependencies, run tests and lint with a
# variety of Python versions
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI

on:
# run pushes to all branches and on pull requests to main
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-test:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: ">=0.10.12"
- name: Install dependencies
run: uv sync --extra all
- name: Ruff check
run: uv run ruff check src/ tests/
- name: Black check
run: uv run black --check src/ tests/
- name: isort check
run: uv run isort --check src/ tests/
- name: Type check with ty
run: uv run ty check

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.8
- 3.9
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: ">=0.10.12"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -y install graphviz
uv sync --extra all
- name: Run tests
run: uv run pytest

package:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get -y install graphviz
python -m pip install --upgrade pip
python -m pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
python -m unittest discover tests '*_tests.py'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v5
with:
version: ">=0.10.12"
- name: Build package
run: uv build
- name: Check package
run: uv run --with twine twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ venv.bak/
.vscode
.idea
.DS_Store
_version.py
161 changes: 161 additions & 0 deletions .icewormignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# 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/
.nox/
.coverage
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
#.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

.idea/
**_build
**_static
.git/
.ruff_cache/
.import_linter_cache/
.uv/
uv.lock
7 changes: 7 additions & 0 deletions .mdl_style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Markdownlint style configuration
# frozen_string_literal: true

all
exclude_rule 'MD024'
rule 'MD013', line_length: 100, ignore_code_blocks: true, tables: false
rule 'MD029', style: 'ordered'
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style '.mdl_style.rb'
Loading
Loading