|
a |
|
b/.github/CONTRIBUTING.md |
|
|
1 |
# Contributing to mmsegmentation |
|
|
2 |
|
|
|
3 |
All kinds of contributions are welcome, including but not limited to the following. |
|
|
4 |
|
|
|
5 |
- Fixes (typo, bugs) |
|
|
6 |
- New features and components |
|
|
7 |
|
|
|
8 |
## Workflow |
|
|
9 |
|
|
|
10 |
1. fork and pull the latest mmsegmentation |
|
|
11 |
2. checkout a new branch (do not use master branch for PRs) |
|
|
12 |
3. commit your changes |
|
|
13 |
4. create a PR |
|
|
14 |
|
|
|
15 |
:::{note} |
|
|
16 |
|
|
|
17 |
- If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first. |
|
|
18 |
- If you are the author of some papers and would like to include your method to mmsegmentation, |
|
|
19 |
please contact Kai Chen (chenkaidev[at]gmail[dot]com). We will much appreciate your contribution. |
|
|
20 |
::: |
|
|
21 |
|
|
|
22 |
## Code style |
|
|
23 |
|
|
|
24 |
### Python |
|
|
25 |
|
|
|
26 |
We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style. |
|
|
27 |
|
|
|
28 |
We use the following tools for linting and formatting: |
|
|
29 |
|
|
|
30 |
- [flake8](http://flake8.pycqa.org/en/latest/): linter |
|
|
31 |
- [yapf](https://github.com/google/yapf): formatter |
|
|
32 |
- [isort](https://github.com/timothycrosley/isort): sort imports |
|
|
33 |
|
|
|
34 |
Style configurations of yapf and isort can be found in [setup.cfg](../setup.cfg) and [.isort.cfg](../.isort.cfg). |
|
|
35 |
|
|
|
36 |
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`, |
|
|
37 |
fixes `end-of-files`, sorts `requirments.txt` automatically on every commit. |
|
|
38 |
The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml). |
|
|
39 |
|
|
|
40 |
After you clone the repository, you will need to install initialize pre-commit hook. |
|
|
41 |
|
|
|
42 |
```shell |
|
|
43 |
pip install -U pre-commit |
|
|
44 |
``` |
|
|
45 |
|
|
|
46 |
From the repository folder |
|
|
47 |
|
|
|
48 |
```shell |
|
|
49 |
pre-commit install |
|
|
50 |
``` |
|
|
51 |
|
|
|
52 |
After this on every commit check code linters and formatter will be enforced. |
|
|
53 |
|
|
|
54 |
>Before you create a PR, make sure that your code lints and is formatted by yapf. |
|
|
55 |
|
|
|
56 |
### C++ and CUDA |
|
|
57 |
|
|
|
58 |
We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). |