Contributions to tmf6 are welcome. This document describes how to contribute to rtmf6.
The project uses Pixi for environments and many tasks. It simplifies workflows considerably. Pixi is very powerful but you don't need know much about it. You only need to install Pixi and type in a few commands provided below. Knowing more about Pixi is useful but no prerequisite.
The best way to contribute is to fork a repository. This description explains how to fork a repository. You only need the branch develop.
After adding your code, you can contribute your changes with a pull request. Collaborating with pull requests provides a comprehensive guide.
All development is done in branches. Following this branch model, we use these types of branches:
| Instance | Branch | Description, Instructions, Notes |
|---|---|---|
| Stable | main |
Accepts merges from Working and Hotfixes |
| Working | develop |
Accepts merges from Features/Issues and Hotfixes |
| Features/Issues | feature/my-new-feature |
Always branch off HEAD of Working |
| Hotfix | hotfix/fix-something-bad |
Always branch off master |
The default branch is develop. The branch main is only used to release a new version. All development happens in feature branches, e.g. feature/dynamic-time-stepping that will be merged into developed via a pull request.
The naming of branches is based on this article.
Only use lowercase-hyphen-separated names with alphanumeric characters (a-z, A-Z, 0–9) and one hyphen between words. Use descriptive names and limit the use of numbers.
Branch prefixes help to identify the purpose of a branch. We use these prefixes:
- Feature branch: Develop a new feature. Example:
feature/rb-heat-river. - Bugfix Branch: Fix a bug. Example:
bugfix/solver-parameter-defaults. - Hotfix Branch: Fix a critical bug that will be directly merged into
main. Example:hotfix/output-deleted-by-accident. - Release branch: Prepare a new production release. Example:
release/0.5.1. - Documentation branch: Write, update, or fix documentation. Example:
docs/tutorial-unstructured-grid - Benchmark branch: Add or modify a benchmark. Example:
benchmark/appelo-2015-slow-kinetics
Benchmarks use rtmf6 for example models. The workflow typically doesn't involve modifying the Python source code. This means running rtmf6 can be done with released version instead of the code in the branch develop. The documentation needs mor setup. The easiest way is to use Pixi. The command pixi shell -e docs will install all needed libraries. Now rtmf6 -V should show the version.
The benchmark should be located in benchmarks/my-benchmark (replace my-benchmark with your benchmark name). The layout should follow this form:
benchmarks/my-benchmark
├── description
│ └── my_benchmark_explained.md
├── model
│ ├── mf6
│ │ ├── ex10_simple.gwfgwt
│ │ ├── ex10_simple.tdis
...
│ │ └── mfsim.nam
│ ├── phreeqcrm
│ │ ├── phreeqc_code.pqi
│ │ ├── phreeqc.dat
│ │ └── post.yaml
│ ├── postprocessing
│ │ ├── postprocess_my_benchmark.py
│ │ └── plot.py
│ ├── preprocessing
│ │ └── create_my_bnenchmark.py
│ ├── rtmf6
│ │ ├── init_conc.ic
│ │ ├── init_equilibrium_phases.ic
│ │ └── init_kinetics.ic
│ └── rtmf6.toml
└── results
└── my_benchmark.png
Additional sub-directories maybe useful.
The documentation is build with Sphinx. Add new directory docs/source/benchmarks/my-benchmark (replace my-benchmark with your benchmark name). The documentation excepts Markdown files and Jupyter Notebooks.
The command pixi run docs-build will build the documentation in docs/_build/html.
A typical workflow could look like this:
- Install git on your computer
- Create an account on GitHub
- Create a fork on GitHub using the button "Fork" on the top right on Github of this repo (see above for more details)
- Clone to your local machine from your fork:
git clone https://github.com/<your.accounct>/rtmf6.git(copy the URL from the green button with "<>Code" on the right top in your fork on GitHub) - On your local machine, make sure your are in branch
develop:git branch - Create your branch:
git switch -c benchmark/my-benchmark(replacemy-benchmarkwith your benchmark name). - Install Pixi
- Activate the
docsenvironment:pixi shell -e docs - Add your benchmark code and try it out with
rmf6from the directory with yourrtmf6.toml - Write your benchmark documentation
- Build the documentation:
pixi run docs-build - Look at the documentation: Click on
docs/_build/html/index.html. - Commit everything:
git add file1 file2andgit ci(of course having multiple commits, one after each sub-step, is even better) - Push to your fork:
git pushgives an error message and tells you what to do to create a new branch on your fork - Got to your fork on Github and click on the green button that offers to create a pull request (PR) and follow the steps
Let us know if this works for you of if the items above are missing something or not clear enough.