Contributions are welcome! This guide covers the modern development workflow.
-
Clone and install:
git clone https://github.com/WoLpH/numpy-stl.git cd numpy-stl uv sync --all-extras -
Install git hooks:
lefthook install
-
Run tests:
uv run pytest
-
Lint and format:
ruff check stl tests ruff format stl tests
-
Type check:
ty check
uv run pytestThis runs all tests with coverage reporting and doctest validation.
To run a subset:
uv run pytest tests/test_mesh.py -xLefthook runs these checks in parallel on every commit:
ruff check-- lintingruff format-- code formatting (auto-fixes staged)ty check-- type checking
If a hook fails, fix the issue and re-commit.
- Formatter: ruff (79-character line length)
- Quotes: single quotes for all strings, including docstrings
- Docstrings: Google-style (
Args:,Returns:,Raises:) - Type hints: required on all functions and methods
uv sync --extra docs
cd docs
uv run sphinx-build -b html . _build/htmlOpen docs/_build/html/index.html to preview.
- The PR should include tests for new functionality
- All CI checks must pass (tests, lint, type checking)
- The PR should work for Python 3.10, 3.11, 3.12, and 3.13
File issues at https://github.com/WoLpH/numpy-stl/issues.
Include:
- Your OS and Python version
- Steps to reproduce
- Expected vs actual behavior
- If applicable, the STL file that triggers the issue
Pull requests apply Ruff fixes before the lint check. With the autofix.ci app installed for this repository, those fixes are committed to the pull request branch, including forks. Findings Ruff cannot fix still fail CI. The CI lint job checks committed files on pushes. The separate autofix.ci workflow also runs on pushes to develop and master and can commit fixes.
Apply the same fixes locally with:
uvx --with tox-uv tox -e ruff-fix