You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+77-10
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,72 @@ branches for new work and pull requests for verifying the work.
10
10
The steps for a new piece of work can be summarised as follows:
11
11
12
12
1. Push up or create [an issue](https://github.com/WMD-group/SMACT/issues).
13
-
2. Create a branch from main, with a sensible name that relates to the issue.
14
-
3. Do the work and commit changes to the branch. Push the branch
13
+
2. Fork the repository, i.e. go to the [`SMACT` repository on GitHub](https://github.com/WMD-group/SMACT) and click the "Fork" button to create a copy of the repository under your own account.
14
+
3. Clone your fork of the repository to your local machine.
4. Install the [uv package manager](https://github.com/astral-sh/uv).
22
+
23
+
```bash
24
+
pip install uv # installs uv package manager
25
+
```
26
+
27
+
5. Create a virtual environment for SMACT.
28
+
29
+
Using `uv`:
30
+
31
+
```bash
32
+
uv create venv # A virtual environment will be created in the current directory
33
+
source .venv/bin/activate # Activate the virtual environment
34
+
```
35
+
36
+
N.B. A virtual environment can also be created using [mamba](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) for those more familiar with mamba/conda.
37
+
38
+
6. Install the package in editable mode with the development, documentation and optional dependencies.
39
+
40
+
```bash
41
+
uv pip install -e ".[dev,docs,optional]"
42
+
pre-commit install # Install pre-commit hooks
43
+
```
44
+
45
+
7. Create a branch from master, with a sensible name that relates to the issue.
46
+
47
+
```bash
48
+
git checkout -b <branch-name># should be run from the master branch
49
+
```
50
+
51
+
8. Do the work and commit changes to the branch. Push the branch
15
52
regularly to GitHub to make sure no work is accidentally lost.
16
-
4. Write or update unit tests for the code you work on.
17
-
5. When you are finished with the work, ensure that all of the unit
18
-
tests pass on your own machine.
19
-
6. Open a pull request [on the pull request page](https://github.com/WMD-group/SMACT/pulls).
20
-
7. If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.
53
+
54
+
```bash
55
+
git add <files>
56
+
git commit -m "A message describing the changes"
57
+
git push origin <branch-name>
58
+
```
59
+
60
+
9. Write or update unit tests for the code you work on.
61
+
10. When you are finished with the work, ensure that all of the unit tests pass on your own machine by running `pytest -v` in the root directory of the repository.
62
+
63
+
11. Open a pull request [on the pull request page](https://github.com/WMD-group/SMACT/pulls).
64
+
12. If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.
65
+
13. For keeping your repository up to date with the master repository, you can add it as a remote to your local repository.
Fetch the latest changes from the master branch to keep it up to date (make sure you are on the master branch ).
72
+
73
+
```bash
74
+
git checkout master
75
+
git pull upstream master
76
+
```
77
+
78
+
Reminder, `pull` is a combination of `fetch` and `merge`. This could lead to merge conflicts if you have made changes to the master branch.
21
79
22
80
## Pull requests
23
81
@@ -32,14 +90,14 @@ Recommended reading: [How to Write the Perfect Pull Request](https://github.blog
32
90
33
91
## Dev requirements
34
92
35
-
When developing locally, it is recommended to install the python packages in `requirements-dev.txt`.
93
+
When developing locally, it is recommended to install the python packages for development and documentation.
36
94
37
95
```bash
38
-
pip install -e ".[dev,docs]"
96
+
pip install -e ".[dev,docs]"# Should be ran from the root of the repository
39
97
```
40
98
41
99
This will allow you to run the tests locally with pytest as described in the main README,
42
-
as well as run pre-commit hooks to automatically format python files with isort and black.
100
+
as well as run pre-commit hooks to automatically format python files with [ruff](https://docs.astral.sh/ruff/).
43
101
To install the pre-commit hooks (only needs to be done once):
44
102
45
103
```bash
@@ -48,3 +106,12 @@ pre-commit run --all-files # optionally run hooks on all files
48
106
```
49
107
50
108
Pre-commit hooks will check all files when you commit changes, automatically fixing any files which are not formatted correctly. Those files will need to be staged again before re-attempting the commit.
109
+
110
+
To render the documentation locally, you can use the following command:
111
+
112
+
```bash
113
+
cd docs
114
+
sphinx-build -nW --keep-going -b html . _build/html/
115
+
```
116
+
117
+
You should then be able to view the documentation by opening `_build/html/index.html` in a web browser. You should inspect the documentation to ensure that it is correctly formatted, any docstrings are present and that the code examples are correct.
0 commit comments