Thank you for considering a contribution! This guide covers everything you need to submit high-quality pull requests.
git clone https://github.com/defnalk/cooltower.git
cd cooltower
make install # installs in editable mode with all dev extras
make example # verify the example runs cleanlyEvery function signature and class attribute must be fully annotated.
mypy --strict must pass with zero errors.
# Good
def humidity_ratio(T_db: float, T_wb: float, P: float = 101_325.0) -> float: ...
# Bad — missing return type
def humidity_ratio(T_db, T_wb, P=101_325.0): ...Use Google style on every public function, class, and module.
Include Args, Returns, and Raises sections.
Add a one-line Example where it aids understanding.
def saturation_pressure(T_db: float) -> float:
"""Compute saturation vapour pressure via the Buck (1981) formula.
Args:
T_db: Dry-bulb temperature [°C].
Returns:
Saturation vapour pressure [Pa].
Raises:
ValueError: If T_db is outside [-100, 200] °C.
Example:
>>> round(saturation_pressure(25.0), 1)
3169.9
"""Every module must define __all__ listing all public names.
No hardcoded numeric literals inside function bodies.
Add new physical constants to cooltower/constants.py.
Use logging.getLogger(__name__) — no print statements.
Make error messages actionable: state the bad value, the constraint, and a hint.
# Good
raise ValueError(
f"Wet-bulb temperature T_wb = {T_wb} °C cannot exceed "
f"dry-bulb temperature T_db = {T_db} °C."
)
# Bad
raise ValueError("Invalid temperature")make format # auto-fix with ruff
make check # lint + format check + mypy (must all pass before PR)- All new functionality must have corresponding unit tests in
tests/unit/. - New pipeline behaviour must have integration tests in
tests/integration/. - Coverage must remain ≥ 90 % (
pytest --cov-fail-under=90). - Use
@pytest.mark.parametrizefor boundary/edge cases. - Use fixtures in
conftest.pyfor shared state; do not duplicate setup.
make test # full suite
make test-unit # fast feedback during development- Branch — branch from
main:git checkout -b feat/your-feature-name - Commit messages — use the conventional commits format:
feat: add Merkel number calculationfix: guard against zero denominator in solve_air_flow_ratedocs: add wet-bulb iteration exampletest: parametrize saturation_pressure boundary cases
- Run checks locally —
make check && make testmust pass cleanly. - Open a PR against
mainwith:- A one-paragraph description of what changed and why.
- A reference to any related issue (
Closes #42).
- CI — all GitHub Actions checks must be green before merge.
- Review — at least one approving review is required.
- Changelog — add an entry under
[Unreleased]inCHANGELOG.md.
Include:
- Python version (
python --version) cooltowerversion (pip show cooltower)- Minimal reproducible example
- Expected vs. actual output / traceback
Include:
- The engineering motivation (equation, reference, use-case)
- Proposed function signature and return type
- Any relevant references (textbook, standard, paper)
By contributing, you agree that your contributions will be licensed under the MIT License that covers this project.