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
+81-68
Original file line number
Diff line number
Diff line change
@@ -1,45 +1,90 @@
1
1
# Contribution Guidelines
2
2
3
-
We appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion. If you plan to contribute new features, utility functions or extensions, please first open an issue and discuss the feature with us.
3
+
Here is a simple guideline to get you started with your first contribution.
4
+
1. Set up your environment to follow our [formatting guidelines](#code-formatting) and to use [signed-commits](#signed-commits).
5
+
2. Use [issues](https://github.com/Deci-AI/super-gradients/issues) to discuss the suggested changes. Create an issue describing changes if necessary and add labels to ease orientation.
6
+
3.[Fork super-gradients](https://help.github.com/articles/fork-a-repo/) so you can make local changes and test them.
7
+
4. Create a new branch for the issue. The branch naming convention is enforced by the CI/CD so please make sure you are using `feature/SG-***` or `hotfix/SG-***` format otherwise it will fail.
8
+
5. Implement your changes along with relevant tests for the issue. Please make sure you are covering unit, integration and e2e tests where required.
9
+
6. Create a pull request against **master** branch.
:param first_argument: First argument to the function
21
+
:param second_argument: Second argument to the function
22
+
:return: Description of the output
23
+
"""
24
+
```
25
+
26
+
27
+
28
+
29
+
## Code Formatting
30
+
31
+
We enforce [black](https://github.com/psf/black) code formatting in addition to existing [flake8](https://flake8.pycqa.org/en/latest/user/index.html) checks.
32
+
33
+
To ensure everyone uses same code style, a project-wise [configuration file](https://github.com/Deci-AI/super-gradients/blob/master/pyproject.toml) has been added to SG repo. It ensures all formatting will be exactly the same regardless of OS, python version or the place where code formatting check is happening.
34
+
35
+
### Installation
36
+
37
+
To start, one need to install required development dependencies (actual versions of black, flake8 and git commit hooks):
38
+
39
+
`$ pip install -r requirements.dev.txt`
40
+
41
+
### Pre-Commit Hooks
42
+
43
+
A pre-commit hook as an easy way to ensure all files in the commit are already formatted accordingly and pass linter checks. If they are not, the git will prevent commit of problematic files unless errors are fixed.
44
+
45
+
To start, run the following command from SG repo root:
46
+
```bash
47
+
$ pip install pre-commit
48
+
$ pre-commit install
49
+
```
50
+
51
+
The command should complete without errors. Once done, all your upcoming commits will be checked via black & flake8.
52
+
53
+
### Usage
54
+
55
+
Just run ```$ black .``` from the SG root. It will reformat the whole repo.
56
+
For flake8: ```$ flake8 --statistics --config scripts/flake8-config setup.py .```
57
+
58
+
59
+
## Signed Commits
60
+
61
+
### Background
62
+
63
+
Signed commits provide a way to verify the authenticity and integrity of the code changes made by a particular developer, as the commit is cryptographically signed using their private GPG key. This helps ensure that the code changes were made by the intended person and have not been tampered with during transit.
64
+
65
+
You can find more information [here](https://withblue.ink/2020/05/17/how-and-why-to-sign-git-commits.html).
66
+
67
+
### Add GPG key to GitHub
68
+
69
+
1.[Generate a new GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)
70
+
2. Copy the GPG key by running the command on step 12 from the link above
10
71
11
-
## How to Contribute
12
-
13
-
Here is a simple guideline to get you started with your first contribution
14
-
1. Use [issues](https://github.com/Deci-AI/super-gradients/issues) to discuss the suggested changes. Create an issue describing changes if necessary and add labels to ease orientation.
15
-
1.[Fork super-gradients](https://help.github.com/articles/fork-a-repo/) so you can make local changes and test them.
16
-
1. Create a new branch for the issue. The branch naming convention is enforced by the CI/CD so please make sure you are using your_username/your_branch_name convention otherwise it will fail.
17
-
1. Create relevant tests for the issue, please make sure you are covering unit, integration and e2e tests where required.
18
-
1. Make code changes.
19
-
1. Ensure all the tests pass and code formatting is up to standards, and follows [PEP8](https://www.python.org/dev/peps/pep-0008/).
20
-
<!--1. We use [pre-commit](https://pre-commit.com/) package to run our pre-commit hooks. Black formatter and flake8 linter will be ran on each commit. In order to set up pre-commit on your machine, follow the steps here, please note that you only need to run these steps the first time you use pre-commit for this project.)
21
-
22
-
* Install pre-commit from pypi
23
-
```
24
-
$ pip install pre-commit
25
-
```
26
-
* Set up pre-commit inside super-gradients repo which will create .git/hooks directory.
27
-
```
28
-
$ pre-commit install
29
-
```
30
-
```
31
-
$ git commit -m "message"
32
-
```
33
-
34
-
* Each time you commit, git will run the pre-commit hooks (black and flake8 for now) on any python files that are getting committed and are part of the git index. If black modifies/formats the file, or if flake8 finds any linting errors, the commit will not succeed. You will need to stage the file again if black changed the file, or fix the issues identified by flake8 and and stage it again.
35
-
36
-
* To run pre-commit on all files just run
37
-
```
38
-
$ pre-commit run --all-files
39
-
```
40
-
-->
41
-
7. Create a pull request against <b>master</b> branch.
72
+
```bash
73
+
$ gpg --armor --export 3AA5C34371567BD2
74
+
```
75
+
76
+
3.[Add the new GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account)
We are working hard to make sure all the code in this repository is readable, maintainable and testable.
60
-
We follow the Google docstring guidelines outlined on this [styleguide](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings) page. For example:
0 commit comments