|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +This guide covers the development workflow and best practices for maintaining Tempest. |
| 4 | + |
| 5 | +## Changelog Maintenance |
| 6 | + |
| 7 | +The changelog follows the [Keep a Changelog](https://keepachangelog.com) format and documents all notable changes to the project. |
| 8 | + |
| 9 | +### When to Update |
| 10 | + |
| 11 | +Update `CHANGELOG.md` when: |
| 12 | +- Adding new features |
| 13 | +- Changing existing functionality |
| 14 | +- Fixing bugs |
| 15 | +- Deprecating or removing features |
| 16 | +- Addressing security vulnerabilities |
| 17 | + |
| 18 | +### Adding Entries |
| 19 | + |
| 20 | +1. Add entries to the `[Unreleased]` section at the top of `CHANGELOG.md` |
| 21 | +2. Use appropriate category: |
| 22 | + - **Added**: New features |
| 23 | + - **Changed**: Changes in existing functionality |
| 24 | + - **Deprecated**: Soon-to-be removed features |
| 25 | + - **Removed**: Now removed features |
| 26 | + - **Fixed**: Bug fixes |
| 27 | + - **Security**: Security vulnerability fixes |
| 28 | + |
| 29 | +3. Provide clear, user-friendly descriptions: |
| 30 | + ```markdown |
| 31 | + ### Added |
| 32 | + - Support for custom proposal distributions |
| 33 | + - New method for computing posterior summaries |
| 34 | + |
| 35 | + ### Fixed |
| 36 | + - Fixed memory leak in parallel MCMC sampling |
| 37 | + - Corrected handling of NaN values in likelihood |
| 38 | + ``` |
| 39 | + |
| 40 | +### Release Process |
| 41 | + |
| 42 | +1. Update version in `tempest/_version.py` |
| 43 | +2. Move `[Unreleased]` entries to new version section: |
| 44 | + ```markdown |
| 45 | + ## [1.1.0] - 2026-01-15 |
| 46 | + |
| 47 | + ### Added |
| 48 | + - (moved from Unreleased) |
| 49 | + ``` |
| 50 | +3. Add release date in ISO 8601 format (YYYY-MM-DD) |
| 51 | +4. Create git tag: |
| 52 | + ```bash |
| 53 | + git tag v1.1.0 |
| 54 | + git push origin v1.1.0 |
| 55 | + ``` |
| 56 | +5. Push to main branch to trigger release workflow in `.github/workflows/release_to_pypi.yml` |
| 57 | +6. Create new `[Unreleased]` section for next version |
| 58 | + |
| 59 | +### Version Links |
| 60 | + |
| 61 | +After creating a release tag, update the version links at the bottom of `CHANGELOG.md`: |
| 62 | +```markdown |
| 63 | +[Unreleased]: https://github.com/minaskar/tempest/compare/v1.1.0...HEAD |
| 64 | +[1.1.0]: https://github.com/minaskar/tempest/releases/tag/v1.1.0 |
| 65 | +[1.0.0]: https://github.com/minaskar/tempest/releases/tag/v1.0.0 |
| 66 | +``` |
| 67 | + |
| 68 | +## Testing |
| 69 | + |
| 70 | +### Running Tests |
| 71 | + |
| 72 | +```bash |
| 73 | +# Run all tests |
| 74 | +python -m unittest discover tests |
| 75 | + |
| 76 | +# Run specific test file |
| 77 | +python -m unittest tests.test_sampler |
| 78 | + |
| 79 | +# Run with pytest (if installed) |
| 80 | +pytest tests/ |
| 81 | +``` |
| 82 | + |
| 83 | +### Test Coverage |
| 84 | + |
| 85 | +Ensure new features include corresponding tests. Test files are in the `tests/` directory. |
| 86 | + |
| 87 | +## Code Style |
| 88 | + |
| 89 | +Tempest uses the following conventions: |
| 90 | +- Type hints where appropriate (Python 3.8+) |
| 91 | +- Docstrings following NumPy style |
| 92 | +- PEP 8 formatting |
| 93 | + |
| 94 | +## Dependencies |
| 95 | + |
| 96 | +Core dependencies are defined in: |
| 97 | +- `pyproject.toml` (project dependencies) |
| 98 | +- `requirements.txt` (simplified list) |
| 99 | + |
| 100 | +When adding new dependencies: |
| 101 | +1. Update both `pyproject.toml` and `requirements.txt` |
| 102 | +2. Consider impact on existing users |
| 103 | +3. Document in changelog |
| 104 | + |
| 105 | +## Documentation |
| 106 | + |
| 107 | +Documentation is built using MkDocs. To build locally: |
| 108 | + |
| 109 | +```bash |
| 110 | +# Install docs requirements |
| 111 | +pip install -r docs/requirements.txt |
| 112 | + |
| 113 | +# Serve docs |
| 114 | +mkdocs serve |
| 115 | + |
| 116 | +# Build docs |
| 117 | +mkdocs build |
| 118 | +``` |
| 119 | + |
| 120 | +## Pull Requests |
| 121 | + |
| 122 | +When submitting a PR: |
| 123 | +1. Update CHANGELOG.md with relevant entries |
| 124 | +2. Add or update tests |
| 125 | +3. Ensure all tests pass |
| 126 | +4. Update documentation if needed |
| 127 | +5. Reference any related issues |
| 128 | + |
| 129 | +## Release Checklist |
| 130 | + |
| 131 | +Before creating a release: |
| 132 | +- [ ] Update version number in `tempest/_version.py` |
| 133 | +- [ ] Update CHANGELOG.md with all changes |
| 134 | +- [ ] Ensure all tests pass |
| 135 | +- [ ] Update documentation if needed |
| 136 | +- [ ] Tag release with `git tag v{version}` |
| 137 | +- [ ] Push tag to trigger PyPI release |
| 138 | +- [ ] Verify release on PyPI |
| 139 | +- [ ] Update GitHub Release notes (manual step) |
0 commit comments