Skip to content

Commit 50d4b5f

Browse files
updated contributing.md file
1 parent cb703e5 commit 50d4b5f

1 file changed

Lines changed: 110 additions & 28 deletions

File tree

CONTRIBUTING.md

Lines changed: 110 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,124 @@
1-
# How to contribute #
1+
# Contributing to Temoa
22

3-
I'm really happy that you're interested in contributing to Temoa! Building a sustainable energy future with an open source energy system model takes a lot of effort, and we can use all the help we can get.
3+
Thank you for your interest in contributing to Temoa! Building a sustainable energy future with an open source energy system model takes a lot of effort, and we welcome all contributions.
44

5-
Here are some resources to help get you started:
6-
* A [preprint](https://temoacloud.com/wp-content/uploads/2019/12/Hunter_etal_2013.pdf) of our Energy Economics paper laying out the motivation for our effort as well as the core model formulation.
7-
* The [model documentation](https://temoacloud.com/docs/), which evolves with changes to the model formulation and the addition of new features.
8-
* Use [our forum](https://groups.google.com/forum/#!forum/temoa-project) to ask questions about the model.
5+
## Resources
96

10-
## Bugs and feature requests ##
11-
If you would like to report a bug in the code or request a feature, please use our [Issue Tracker](https://github.com/TemoaProject/temoa/issues). If you're unsure or have questions, use [the forum](https://groups.google.com/forum/#!forum/).
7+
- **Documentation**: [https://docs.temoaproject.org/en/latest/](https://docs.temoaproject.org/en/latest/)
8+
- **Project Website**: [https://temoaproject.org](https://temoaproject.org)
9+
- **Issue Tracker**: [https://github.com/TemoaProject/temoa/issues](https://github.com/TemoaProject/temoa/issues)
10+
- **Academic Paper**: Hunter et al. (2013) - [Modeling for insight using Tools for Energy Model Optimization and Analysis (Temoa)](https://doi.org/10.1016/j.eneco.2013.07.014)
1211

13-
## Submitting Changes ##
12+
## Getting Help
1413

15-
To make changes to the code, first clone the repository. If you would like to share those changes back to our main repository, then you need to issue a pull request on GitHub. Details on how to contribute code are nicely outlined in [this blog post by Rob Allen](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/). If you'd like to make changes but don't feel comfortable with GitHub, get in touch with us through the [forum](https://groups.google.com/forum/#!forum/).
14+
If you have questions or need help:
15+
- **Bug Reports & Feature Requests**: Use our [GitHub Issues](https://github.com/TemoaProject/temoa/issues). Please use the provided templates for Bug Reports or Feature Requests.
16+
- **General Questions**: Open an issue using the **Question** template. We have phased out the legacy Google Group forum in favor of GitHub-based discussions.
1617

17-
When making commits to the repository, please use verbose commit messages for all but the simplest changes. Every commit to the repository should include an appropriate summary message about the accompanying code changes. Include enough context so that users get a high-level understanding of the changes without having to check the code. For example, "Fixed broken algorithm" does not convey much information. A more appropriate and complete summary message might be:
18+
## Development Setup
1819

20+
### Prerequisites
21+
22+
- Python 3.12 or higher
23+
- [uv](https://github.com/astral-sh/uv) (recommended)
24+
- Git
25+
26+
### Setting Up Your Development Environment
27+
28+
1. **Fork and clone the repository:**
29+
```bash
30+
git clone https://github.com/YOUR-USERNAME/temoa.git
31+
cd temoa
32+
```
33+
34+
2. **Install dependencies using uv (recommended):**
35+
```bash
36+
# Install all dependencies including development tools
37+
uv sync --all-extras --dev
38+
```
39+
40+
3. **Install pre-commit hooks:**
41+
```bash
42+
uv run pre-commit install
43+
```
44+
This will automatically run code quality checks (Ruff, Mypy) before each commit.
45+
46+
## Infrastructure & Testing
47+
48+
We maintain a robust testing infrastructure to ensure model correctness and code reliability.
49+
50+
### Solvers
51+
All core tests are designed to run using the **HiGHS** solver (provided by the `highspy` core dependency).
52+
53+
### Running Tests
54+
55+
```bash
56+
# Run all tests
57+
uv run pytest
58+
59+
# Run with coverage report
60+
uv run pytest --cov=temoa --cov-report=html
61+
62+
# Run specific test file
63+
uv run pytest tests/test_specific.py
1964
```
20-
Add NEOS solve functionality to config file
2165

22-
With this commit, users can now use the NEOS server: https://neos-server.org/neos/
23-
to solve their Temoa models. If users do not have a local install of cplex, this
24-
is a potentially faster option. Note that when using NEOS, both --neos and --solver
25-
must be used in the config file.
66+
### Testing Infrastructure
67+
If you are writing a new feature, you **must** include tests that verify its functionality.
68+
- Refer to `tests/conftest.py` for the available testing infrastructure.
69+
- Use the `system_test_run` fixture for full model execution tests.
70+
- Test databases are automatically refreshed from SQL scripts in `tests/testing_data/` during the test setup phase.
71+
72+
## Code Quality Tools
73+
74+
We use several tools to maintain high code standards:
75+
76+
### Type Checking with mypy
77+
All new code must include type hints. We enforce strict typing for core modules.
78+
```bash
79+
uv run mypy temoa
80+
```
81+
82+
### Linting and Formatting with Ruff
83+
We use Ruff for both linting and formatting.
84+
```bash
85+
# Check and auto-fix linting issues
86+
uv run ruff check --fix .
87+
88+
# Format code
89+
uv run ruff format .
2690
```
2791

28-
In general, we try to follow [these 7 rules](https://chris.beams.io/posts/git-commit/) when writing commit messages:
92+
## Making Changes
93+
94+
### Pull Request Process
95+
96+
1. **Open an Issue first**: For significant changes or new features, please open an issue to discuss the approach before starting work.
97+
2. **Create a new branch**:
98+
```bash
99+
git checkout -b feature/your-feature-name
100+
```
101+
3. **Implement and Test**: Ensure your changes follow the [Code Style Guidelines](#code-style-guidelines) and include relevant tests.
102+
4. **Verify Locally**: Run `pytest`, `mypy`, and `ruff` locally before pushing.
103+
5. **Open a Pull Request**: Submit your PR against the `main` branch. Ensure the PR description clearly explains the changes and links to the relevant issue.
104+
105+
### Commit Message Guidelines
106+
107+
We advice following the [Conventional Commits](https://www.conventionalcommits.org/) style.
108+
109+
**Format:** `<type>: <subject>` (e.g., `feat: Add new carbon constraint`)
110+
111+
**Rules:**
112+
1. Use the imperative mood ("Add feature" not "Added feature").
113+
2. Limit the subject line to 50 characters.
114+
3. Use the body to explain *what* and *why* vs. *how*.
115+
116+
## Code Style Guidelines
29117

30-
1. Separate subject from body with a blank line
31-
2. Limit the subject line to 50 characters
32-
3. Capitalize the subject line
33-
4. Do not end the subject line with a period
34-
5. Use the imperative mood in the subject line
35-
6. Wrap the body at 72 characters
36-
7. Use the body to explain what and why vs. how
118+
- **Type Hints**: Required for all public function signatures.
119+
- **Docstrings**: Use Google-style docstrings.
120+
- **Line Length**: Maximum 100 characters (enforced by Ruff).
37121

38-
Regarding how we format code, please see Chapter 7 of our user manual, which serves as the Temoa Code Style Guide. Be sure that all modified files included in the pull request have unix line endings.
122+
---
39123

40-
Thanks,
41-
Joe DeCarolis
42-
NC State University
124+
Thank you for contributing to Temoa!

0 commit comments

Comments
 (0)