|
| 1 | +# Contributing to mache |
| 2 | + |
| 3 | +Thank you for your interest in contributing to `mache`! We welcome |
| 4 | +contributions of all kinds, including bug reports, feature requests, code, and |
| 5 | +documentation improvements. |
| 6 | + |
| 7 | +## How to Contribute |
| 8 | + |
| 9 | +- **Bug Reports & Feature Requests:** |
| 10 | + Please use [GitHub Issues](https://github.com/E3SM-Project/mache/issues) to |
| 11 | + report bugs or request features. |
| 12 | + |
| 13 | +- **Pull Requests:** |
| 14 | + Fork the repository, create a new branch for your changes, and submit a pull |
| 15 | + request (PR) to the `main` branch. Please provide a clear description of |
| 16 | + your changes. |
| 17 | + |
| 18 | +## Development Environment |
| 19 | + |
| 20 | +1. **Set up an isolated environment:** |
| 21 | + ```bash |
| 22 | + conda config --add channels conda-forge |
| 23 | + conda config --set channel_priority strict |
| 24 | + conda create -y -n mache_dev --file spec-file.txt |
| 25 | + conda activate mache_dev |
| 26 | + python -m pip install --no-deps --no-build-isolation -e . |
| 27 | + ``` |
| 28 | + |
| 29 | +2. **Install pre-commit hooks:** |
| 30 | + ```bash |
| 31 | + pre-commit install |
| 32 | + ``` |
| 33 | + This ensures code style and quality checks run automatically on each |
| 34 | + commit. |
| 35 | + |
| 36 | +## Code Style and Linting |
| 37 | + |
| 38 | +- Follow [PEP8](https://peps.python.org/pep-0008/) and project code style. |
| 39 | +- The following tools are used (via [pre-commit](https://pre-commit.com/)): |
| 40 | + - [ruff](https://docs.astral.sh/ruff/) for linting and formatting |
| 41 | + - [flynt](https://github.com/ikamensh/flynt) for f-string conversion |
| 42 | + - [mypy](https://mypy-lang.org/) for type checking |
| 43 | + |
| 44 | +If a pre-commit hook fails, fix the reported issues and recommit. |
| 45 | + |
| 46 | +## Testing |
| 47 | + |
| 48 | +- Add or update tests for new features or bug fixes. |
| 49 | +- Run the test suite before submitting a PR: |
| 50 | + ```bash |
| 51 | + pytest |
| 52 | + ``` |
| 53 | + |
| 54 | +## Documentation |
| 55 | + |
| 56 | +- Document all public functions and classes using docstrings. |
| 57 | +- Update the [API documentation](api.md) if you add or modify public APIs. |
| 58 | +- Build and preview the documentation locally: |
| 59 | + ```bash |
| 60 | + cd docs |
| 61 | + DOCS_VERSION=test make clean versioned-html |
| 62 | + ``` |
| 63 | + |
| 64 | +## Pull Request Checklist |
| 65 | + |
| 66 | +- [ ] User's Guide has been updated if needed |
| 67 | +- [ ] Developer's Guide has been updated if needed |
| 68 | +- [ ] API documentation lists any new or modified class, method, or function |
| 69 | +- [ ] Documentation builds cleanly and changes look as expected |
| 70 | +- [ ] Tests pass and new features are covered by tests |
| 71 | +- [ ] PR description includes a summary and any relevant issue references |
| 72 | +- [ ] `Testing` comment, if appropriate, in the PR documents testing used to verify the changes |
| 73 | + |
| 74 | +Thank you for helping improve `mache`! |
0 commit comments