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
* open a [GitHub Issue](https://github.com/mdtanker/invert4geom/issues/new/choose) describing what you want to do
5
+
*[fork](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) the main branch and clone it locally
6
+
*[create a branch](https://docs.github.com/en/get-started/using-github/github-flow#create-a-branch) for your edits
7
+
* make your changes, and commit them using the [Angular Commits Convention](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary)
8
+
*[make a Pull Request](http://makeapullrequest.com/) for your branch
9
+
2
10
🎉 Thanks for considering contributing to this package! 🎉
3
11
4
12
<sub>Adapted from the great contribution guidelines of the [Fatiando a Terra](https://www.fatiando.org/) packages<sub>.
@@ -23,11 +31,13 @@ Also, checkout the [Zen of Scientific Software Maintenance](https://jrleeman.git
23
31
*[Reporting a Bug](#reporting-a-bug)
24
32
*[Editing the Documentation](#editing-the-documentation)
25
33
*[Contributing Code](#contributing-code)
34
+
-[Setting up Make](#setting-up-make)
26
35
-[Setting up your environment](#setting-up-your-environment)
27
36
-[Code style and linting](#code-style-and-linting)
28
37
-[Testing your code](#testing-your-code)
29
38
-[Documentation](#documentation)
30
-
-[Code Review](#code-review)
39
+
-[Committing changes](#committing-changes)
40
+
-[Code review](#code-review)
31
41
*[Publish a new release](#publish-a-new-release)
32
42
*[Update the Dependencies](#update-the-dependencies)
33
43
*[Set up Binder](#set-up-the-binder-configuration)
@@ -104,8 +114,7 @@ You can submit fixes to the documentation pages completely online without having
104
114
* Click on that link to open the respective source file on GitHub for editing online (you'll need a GitHub account).
105
115
* Make your desired changes.
106
116
* When you're done, scroll to the bottom of the page.
107
-
* Fill out the two fields under "Commit changes": the first is a short title describing your fixes, start this with "docs:"; the second is a more detailed description of the changes.
108
-
Try to be as detailed as possible and describe *why* you changed something.
117
+
* Fill out the two fields under "Commit changes": the first is a short title describing your fixes, start this with `docs: `, then your short title; the second is a more detailed description of the changes. Try to be as detailed as possible and describe *why* you changed something.
109
118
* Click on the "Commit changes" button to open a pull request (see below).
110
119
* We'll review your changes and then merge them in if everything is OK.
111
120
* Done 🎉🍺
@@ -123,35 +132,74 @@ Please take a look at these resources to learn about git and pull requests (don'
123
132
124
133
If you're new to working with git, GitHub, and the Unix Shell, we recommend starting with the [Software Carpentry](https://software-carpentry.org/) lessons, which are available in English and Spanish:
125
134
126
-
*:gb:[Version Control with Git](http://swcarpentry.github.io/git-novice/) / :es:[Control de versiones con Git](https://swcarpentry.github.io/git-novice-es/)
127
-
*:gb:[The Unix Shell](http://swcarpentry.github.io/shell-novice/) / :es:[La Terminal de Unix](https://swcarpentry.github.io/shell-novice-es/)
135
+
* 🇬🇧 [Version Control with Git](http://swcarpentry.github.io/git-novice/) / 🇪🇸 [Control de versiones con Git](https://swcarpentry.github.io/git-novice-es/)
have a chance to check that the code is up to standards and passes all our tests.
145
+
This way, the *main* branch is always stable.
146
+
147
+
General guidelines for pull requests (PRs):
148
+
149
+
***Open an issue first** describing what you want to do. If there is already an issue
150
+
that matches your PR, leave a comment there instead to let us know what you plan to
151
+
do.
152
+
* Each pull request should consist of a **small** and logical collection of changes.
153
+
* Larger changes should be broken down into smaller components and integrated
154
+
separately.
155
+
* Bug fixes should be submitted in separate PRs.
156
+
* Describe what your PR changes and *why* this is a good thing. Be as specific as you
157
+
can. The PR description is how we keep track of the changes made to the project over
158
+
time.
159
+
* Write descriptive commit messages. Chris Beams has written a
160
+
[guide](https://chris.beams.io/posts/git-commit/) on how to write good commit
161
+
messages.
162
+
* Be willing to accept criticism and work on improving your code; we don't want to break
163
+
other users' code, so care must be taken not to introduce bugs.
164
+
* Be aware that the pull request review process is not immediate, and is generally
165
+
proportional to the size of the pull request.
166
+
167
+
### Setting up `make`
168
+
169
+
Most of the commands used in the development of `PolarToolkit` use the tool `make`.
170
+
The `make` commands are defined in the file [`Makefile`](https://github.com/mdtanker/polartoolkit/blob/main/Makefile), and are run in the terminal / command prompt with the format ```make <<command name>>```.
128
171
172
+
If you don't want to use `make`, you can always open the `Makefile` and copy and past the command you need into the terminal.
173
+
174
+
`make` is typically included in most unix systems, but can be installed explicitly with a package manager such as `Homebrew` for MacOS, or `RPM` or`DNF` for Linux, or `Chocalatey` for Windows.
175
+
176
+
Run `make -version` to test that `make` is correctly installed.
Run the following command to make a new environment and install the package dependencies:
191
+
Run the following `make`command to create a new environment and install the package dependencies:
144
192
145
193
```
146
-
make create
194
+
make create
147
195
```
148
196
Activate the environment:
149
197
```
150
-
conda activate invert4geom
198
+
conda activate invert4geom
151
199
```
152
200
Install your local version:
153
201
```
154
-
make install
202
+
make install
155
203
```
156
204
This environment now contains your local, editable version of Invert4Geom, meaning if you alter code in the package, it will automatically include those changes in your environment (you may need to restart your kernel if using Jupyter).
157
205
If you need to update the dependencies, see the [update the dependencies](#update-the-dependencies) section below.
@@ -160,35 +208,22 @@ If you need to update the dependencies, see the [update the dependencies](#updat
160
208
161
209
### Code style and linting
162
210
163
-
We use [Ruff](https://docs.astral.sh/ruff/) to format the code so we don't have to think about it.
164
-
This allows you to not think about proper indentation, line length, or aligning your code while to development.
165
-
Before committing, or periodically while you code, run the following to automatically format your code:
166
-
```
167
-
make format
168
-
```
169
-
Some formatting changes can't be applied automatically. Running the following to see these.
211
+
We use [pre-commit](https://pre-commit.com/) to check code style. This can be used locally, by installing pre-commit, or can be used as a pre-commit hook, where it is automatically run by git for each commit to the repository. This pre-commit hook wont add or commit any changes, but will just inform your of what should be changed. Pre-commit is setup within the `.pre-commit-config.yaml` file. There are lots of hooks (processes) which run for each pre-commit call, including [Ruff](https://docs.astral.sh/ruff/) to format and lint the code. This allows you to not think about proper indentation, line length, or aligning your code during development. Before committing, or periodically while you code, run the following to automatically format your code:
170
212
```
171
-
make check
213
+
make check
172
214
```
173
-
Go through the output of this and try to change the code based on the errors.
174
-
Search the error codes on the [Ruff documentation](https://docs.astral.sh/ruff/), which should give suggestions.
175
-
Re-run the check to see if you've fixed it.
176
-
Somethings can't be resolved (unsplittable urls longer than the line length).
177
-
For these, add `# noqa: []` at the end of the line and the check will ignore it.
178
-
Inside the square brackets add the specific error code you want to ignore.
179
215
180
-
We also use [Pylint](https://pylint.readthedocs.io/en/latest/), which performs static-linting on the code.
181
-
This checks the code and catches many common bugs and errors, without running any of the code.
182
-
This check is slightly slower the the `Ruff` check. Run it with the following:
216
+
Go through the output of this and try to change the code based on the errors. Search the error codes on the [Ruff documentation](https://docs.astral.sh/ruff/), which should give suggestions. Re-run the check to see if you've fixed it. Somethings can't be resolved (unsplittable urls longer than the line length). For these, add `# noqa: []` at the end of the line and the check will ignore it. Inside the square brackets add the specific error code you want to ignore.
217
+
218
+
We also use [Pylint](https://pylint.readthedocs.io/en/latest/), which performs static-linting on the code. This checks the code and catches many common bugs and errors, without running any of the code. This check is slightly slower the the `Ruff` check. Run it with the following:
183
219
```
184
-
make pylint
220
+
make pylint
185
221
```
186
-
Similar to using `Ruff`, go through the output of this, search the error codes on the [Pylint documentation](https://pylint.readthedocs.io/en/latest/) for help, and try and fix all the errors and warnings.
187
-
If there are false-positives, or your confident you don't agree with the warning, add ` # pylint: disable=` at the end of the lines, with the warning code following the `=`.
222
+
Similar to using `Ruff`, go through the output of this, search the error codes on the [Pylint documentation](https://pylint.readthedocs.io/en/latest/) for help, and try and fix all the errors and warnings. If there are false-positives, or your confident you don't agree with the warning, add ` # pylint: disable=` at the end of the lines, with the warning code following the `=`.
188
223
189
-
To run all three of the code checks, use:
224
+
To run both pre-commit and pylint together use:
190
225
```
191
-
make style
226
+
make style
192
227
```
193
228
194
229
### Docstrings
@@ -270,6 +305,42 @@ Add, commit, and push all changes to GitHub in a Pull Request, and `RTD` should
270
305
In each PR, you will see section of the checks for `RTD`. Click on this to preview the docs for the PR.
271
306
`RTD` uses the conda environment specified in `env/RTD_env.yml` when it's building.
272
307
308
+
### Committing changes
309
+
310
+
Once your have made your changes locally, you'll need to make a branch, commit the changes, and create a PR. We use the [Angular Commits Convention](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary) for commit messages. This allows automatic creation of the Changelogs, and automatic determination of what the next version will be. All commits should follow the below structure:
311
+
```
312
+
<type>: <description>
313
+
314
+
[optional body]
315
+
```
316
+
317
+
Where `type` is one of the following:
318
+
*`docs` --> a change to the documents
319
+
*`style`--> simple fixes to the styling of the code
320
+
*`feat` --> any new features
321
+
*`fix` --> bug fixes
322
+
*`build` --> changes to the package build process, i.e. dependencies, changelogs etc.
323
+
*`chore` --> maintenance changes, like GitHub Action workflows
324
+
*`refactor` --> refactoring of the code without user-seen changes
325
+
326
+
The `optional body` can include any detailed description, and can optionally start with `BREAKING CHANGE: `.
327
+
328
+
Based on the commit message, one of four things will happen when;
329
+
1) no new version will be released
330
+
2) a `PATCH` version will be released (`v1.1.0 -> v1.1.1`)
331
+
3) a `MINOR` version will be released (`v1.1.0 -> v1.2.0`)
332
+
4) a `MAJOR` version will be released (`v1.1.0 -> v2.0.0`)
333
+
334
+
This follows [Semantic Versioning](https://semver.org/#summary) where given a version number `MAJOR.MINOR.PATCH`, the software should increment the:
335
+
1)`MAJOR` version when you make incompatible API changes
336
+
2)`MINOR` version when you add functionality in a backward compatible manner
337
+
3)`PATCH` version when you make backward compatible bug fixes
338
+
339
+
The following will occur based on your commit message:
340
+
*`BREAKING CHANGE: ` will always result in a `MAJOR` release
341
+
*`feat` will always result in a `MINOR` release
342
+
*`fix` will always result in a `PATCH` release
343
+
273
344
### Code Review
274
345
275
346
After you've submitted a pull request, you should expect to hear at least a comment within a couple of days.
0 commit comments