|
1 | 1 | # Contributing to OpenFE |
2 | 2 |
|
3 | | -We welcome any fixes or code contributions to the **openfe** and the larger OpenFE ecosystem. |
| 3 | +We welcome fixes and code contributions to **openfe** and the [larger OpenFE ecosystem](https://github.com/OpenFreeEnergy). |
4 | 4 | Note that any contributions made must be made under a MIT license. |
5 | 5 |
|
6 | 6 | Please read our [code of conduct](Code_of_Conduct.md) to understand the standards you must adhere to. |
7 | 7 |
|
8 | | -## Installing a Dev Environment |
| 8 | +## Installing a Development Environment |
9 | 9 |
|
10 | | -It's common to need to develop openfe and gufe in tandem, to do so: |
11 | | -- gufe is strictly upstream of openfe, meaning that all gufe code should be test in gufe. |
| 10 | +### Installing openfe for development |
12 | 11 |
|
13 | | -- mamba create -f env.yaml in openfe |
14 | | -- pip install -e . # in openfe/dev_branch |
15 | | -- pip install -e . # in gufe/dev_branch |
| 12 | +``` bash |
| 13 | +mamba env create -f environment.yml |
| 14 | +mamba activate openfe_env |
| 15 | +python -m pip install -e --no-deps . |
| 16 | +``` |
16 | 17 |
|
17 | | -to make CI test the environments properly; |
18 | | -- in openfe/env.yaml and openfe/docs/env.yaml, pin gufe to your dev working branch |
| 18 | +### Multi-project development |
| 19 | +It's common to need to develop *openfe** in tandem with another OpenFE Ecosystem package. |
| 20 | +For example, you may want to add some feature to **gufe**, and make sure that its functionality works as intended with **openfe**. |
19 | 21 |
|
20 | | -once you're ready to merge: |
21 | | -- merge in gufe PR |
22 | | -- switch openfe env.yamls back to gufe@main, then push |
| 22 | +To build dev versions of both packages locally, follow the above instructions for installing **openfe** for development, then (using **gufe** as an example): |
23 | 23 |
|
| 24 | +``` bash |
| 25 | +mamba activate openfe_env # if not already activated |
| 26 | +git clone git@github.com:OpenFreeEnergy/gufe.git |
| 27 | +cd gufe/ |
| 28 | +pip install -e . |
| 29 | +``` |
24 | 30 |
|
25 | | -## Contributing a new feature (multi-PR contributing) |
26 | | -- open an issue describing the feature you want to contribute |
27 | | - - use sub issues for larger, more complex project. You are encouraged to add sub issues throughout the development process. Try to aim for 1 PR per issue. |
28 | | -- you may want to request that maintainers create a designated branch for large features that require multiple PRs |
29 | | - - this way, you can work off of a fork, with this feat/ branch as the target. |
30 | | -- make a feat/my-new-feature branch that will be long-lived branch |
31 | | -- break your work into smaller issue/PR pairs that target `feat/my-new-feature`, and ask for frequent reviews. |
32 | | -- PR title should be essentially a changelog entry |
| 31 | +To make sure the CI tests run properly on your PR, in `openfe/env.yaml` and `openfe/docs/env.yaml`, pin **gufe** to your dev working branch |
33 | 32 |
|
34 | | -## CI, linting, style guide |
35 | | -- CI tests, docs, etc, will run on every PR that as `main` as a target. |
36 | | -- pre-commit comment |
37 | | -- rebase or merge, we don't care, but keep your branch up to date with `main` |
38 | | -- SQUASH ALWAYS 🍠 |
39 | | -- [numpy docstrings](https://numpydoc.readthedocs.io/en/latest/format.html), use type hinting as much as is reasonable. |
40 | | -- tests in every PR |
41 | | -- using `precommit` locally: |
42 | | - - pyproject.toml |
43 | | -- any pins to versions in environments etc. need to have a comment explaining why, linking to the related issue, etc. |
| 33 | +```yaml |
| 34 | +... |
44 | 35 |
|
45 | | -## Review process |
46 | | -- In general, push PRs early so that work is visibile, but leave a PR in draft-mode until you want it to be reviewed by the team. Once it's marked as "ready for review," the OpenFE team will assign a reviewer. |
| 36 | + - pip: |
| 37 | + - git+https://github.com/OpenFreeEnergy/gufe@feat/your-dev-branch |
| 38 | +``` |
| 39 | +Once tests pass, the PR is approved, and you're ready to merge: |
| 40 | + 1. merge in the **gufe** PR |
| 41 | + 2. switch `openfe/env.yaml` and `openfe/docs/env.yaml` back to `gufe@main`, then re-run CI. |
47 | 42 |
|
48 | | -# TODO: ai use disclosure |
| 43 | +## Contribution Guidelines |
| 44 | + |
| 45 | +### Use semantic branch names |
| 46 | +- Start branch names with one of the following "types", followed by a short description or issue number. |
| 47 | + - `feat/`: new user-facing feature |
| 48 | + - `fix/`: bugfixes |
| 49 | + - `docs/`: changes to documentation only |
| 50 | + - `refactor/`: refactoring that does not change behavior |
| 51 | + - `ci/`: changes to CI workflows |
| 52 | + |
| 53 | +<!-- - PR titles should be essentially a changelog entry. TODO: make this clearer, maybe examples --> |
| 54 | + |
| 55 | +### CI, linting, style guide |
| 56 | +- CI tests, docs, etc, will run on every PR that has `main` or a branch that begins with `feat/` as a target. |
| 57 | +- Add a news item for any user-facing changes. |
| 58 | +- Rebase or merge, we don't care, but keep your branch up to date with `main`. |
| 59 | +- Always "squash and merge" to keep the git log readable. |
| 60 | +- Use [numpy docstrings](https://numpydoc.readthedocs.io/en/latest/format.html) |
| 61 | +- We encourage but do not require [type hints](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html). |
| 62 | +- Every PR should have tests that cover changes. You will see the coverage report in CI. |
| 63 | +- Any pins to versions in `environment.yaml` etc. need to have a comment explaining the purpose of the pin and/or a link to the related issue. |
| 64 | + |
| 65 | +<!-- TODO: add info about pre-commit comment --> |
| 66 | +<!-- TODO: using `precommit` locally: pyproject.toml --> |
| 67 | + |
| 68 | + |
| 69 | +### Review process |
| 70 | +- In general, push PRs early so that work is visible, but leave a PR in draft-mode until you want it to be reviewed by the team. Once it's marked as "ready for review," the OpenFE team will assign a reviewer. |
| 71 | + |
| 72 | +### Larger contributions (multi-PR contributions) |
| 73 | +- [Open an issue](https://github.com/OpenFreeEnergy/openfe/issues) describing the feature you want to contribute and get feedback from the OpenFE team. Use sub-issues to break down larger, more complex projects. |
| 74 | + - You are encouraged to add sub issues throughout the development process. |
| 75 | + - Try to aim for 1 PR per issue! |
| 76 | +- You may want to request that maintainers create a designated branch for large features that require multiple PRs. This way, the `feat/` branch can be the target of several smaller PRs. |
| 77 | +- Break your work into smaller issue/PR pairs that target `feat/my-new-feature`, and ask for frequent reviews. |
| 78 | + |
| 79 | + <!-- TODO: ai use disclosure --> |
0 commit comments