|
| 1 | +# {{project_name}} Development Guide |
| 2 | + |
| 3 | +This document provides a guide for contributing to the development of this project, and can include information such as design principles, core abstractions, API conventions, development workflow, and best-practices. |
| 4 | + |
| 5 | +## Design Goals and North Stars |
| 6 | +**CRITICAL: Always keep these design principles in mind when making changes to the project.** |
| 7 | + |
| 8 | +**Correctness is the Top Priority.** The code should include thorough tests. Any approximations should be clearly documented and communicated to the user. |
| 9 | + |
| 10 | +**Code should be modular and use a few consistent APIs.** |
| 11 | + |
| 12 | +**Make Easy Things Easy, Hard Things Possible.** Common use cases should require minimal configuration or set up, but users should also be able to perform complex work. |
| 13 | + |
| 14 | +**Code should follow a standard format** with automatic formatting supported by `ruff`. |
| 15 | + |
| 16 | +**Code should be documented.** Docstrings should provide sufficient API information, such as parameter explanations, for users to understand the code. |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +## Common Commands |
| 21 | + |
| 22 | +```bash |
| 23 | +# All tests |
| 24 | +python -m pytest |
| 25 | + |
| 26 | +# Parallel tests |
| 27 | +python -m pytest -n auto |
| 28 | + |
| 29 | +# Lint and format (let the linter fix style — do not hand-tune) |
| 30 | +{% if 'ruff_lint' in enforce_style or 'ruff_format' in enforce_style -%} |
| 31 | +ruff check src/ tests/ |
| 32 | +ruff format src/ tests/ |
| 33 | +{% endif -%} |
| 34 | +{% if 'black' in enforce_style -%} |
| 35 | +black src/ |
| 36 | +black test/ |
| 37 | +{% endif -%} |
| 38 | + |
| 39 | + |
| 40 | +# Pre-commit (runs ruff lint/format, workflow/pyproject schema checks, pytest, etc.) |
| 41 | +pre-commit run --all-files |
| 42 | + |
| 43 | +{% if include_docs -%} |
| 44 | +# Build docs |
| 45 | +sphinx-build -M html ./docs ./_readthedocs |
| 46 | +{% endif -%} |
| 47 | +``` |
| 48 | + |
| 49 | +## Repository Structure |
| 50 | + |
| 51 | +``` |
| 52 | +src/{{package_name}}/ Main package |
| 53 | +tests/{{package_name}}/ Test suite |
| 54 | +{% if include_docs -%} |
| 55 | +docs/ Sphinx documentation sources |
| 56 | +{% endif -%} |
| 57 | +{% if include_benchmarks -%} |
| 58 | +benchmarks/ ASV performance benchmarks |
| 59 | +{% endif -%} |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +## Testing Conventions |
| 64 | + |
| 65 | +- **File naming:** `tests/{{package_name}}/<SUBDIR>/test_<name>.py`, mirroring the `src/{{package_name}}/` layout. |
| 66 | +- **Fixtures:** defined in `tests/conftest.py`. Use existing fixtures, do not duplicate test data. |
| 67 | +- Default test run: `python -m pytest` |
| 68 | + |
0 commit comments