|
1 |
| -Contributing |
2 |
| -============ |
| 1 | +# Contributing |
3 | 2 |
|
4 |
| -DJA should be easy to contribute to. |
| 3 | +Django REST Framework JSON API (aka DJA) should be easy to contribute to. |
5 | 4 | If anything is unclear about how to contribute,
|
6 | 5 | please submit an issue on GitHub so that we can fix it!
|
7 | 6 |
|
8 |
| -How |
9 |
| ---- |
| 7 | +Before writing any code, have a conversation on a GitHub issue to see |
| 8 | +if the proposed change makes sense for the project. |
10 | 9 |
|
11 |
| -Before writing any code, |
12 |
| -have a conversation on a GitHub issue |
13 |
| -to see if the proposed change makes sense |
14 |
| -for the project. |
| 10 | +## Setup development environment |
15 | 11 |
|
16 |
| -Fork DJA on [GitHub](https://github.com/django-json-api/django-rest-framework-json-api) and |
17 |
| -[submit a Pull Request](https://help.github.com/articles/creating-a-pull-request/) |
18 |
| -when you're ready. |
| 12 | +### Clone |
19 | 13 |
|
20 |
| -For maintainers |
21 |
| ---------------- |
| 14 | +To start developing on Django REST Framework JSON API you need to first clone the repository: |
22 | 15 |
|
23 |
| -To upload a release (using version 1.2.3 as the example): |
| 16 | + git clone https://github.com/django-json-api/django-rest-framework-json-api.git |
24 | 17 |
|
25 |
| -```bash |
26 |
| -(venv)$ python setup.py sdist bdist_wheel |
27 |
| -(venv)$ twine upload dist/* |
28 |
| -(venv)$ git tag -a v1.2.3 -m 'Release 1.2.3' |
29 |
| -(venv)$ git push --tags |
30 |
| -``` |
| 18 | +### Testing |
| 19 | + |
| 20 | +To run tests clone the repository, and then: |
| 21 | + |
| 22 | + # Setup the virtual environment |
| 23 | + python3 -m venv env |
| 24 | + source env/bin/activate |
| 25 | + pip install -r requirements.txt |
| 26 | + |
| 27 | + # Format code |
| 28 | + black . |
| 29 | + |
| 30 | + # Run linting |
| 31 | + flake8 |
| 32 | + |
| 33 | + # Run tests |
| 34 | + pytest |
| 35 | + |
| 36 | +### Running against multiple environments |
| 37 | + |
| 38 | +You can also use the excellent [tox](https://tox.readthedocs.io/en/latest/) testing tool to run the tests against all supported versions of Python and Django. Install `tox` globally, and then simply run: |
| 39 | + |
| 40 | + tox |
| 41 | + |
| 42 | + |
| 43 | +### Setup pre-commit |
| 44 | + |
| 45 | +pre-commit hooks is an additional option to check linting and formatting of code independent of |
| 46 | +an editor before you commit your changes with git. |
| 47 | + |
| 48 | +To setup pre-commit hooks first create a testing environment as explained above before running below commands: |
| 49 | + |
| 50 | + pip install pre-commit |
| 51 | + pre-commit install |
| 52 | + |
| 53 | +## For maintainers |
| 54 | + |
| 55 | +To upload a release (using version 1.2.3 as the example) first setup testing environment as above before running below commands: |
| 56 | + |
| 57 | + python setup.py sdist bdist_wheel |
| 58 | + twine upload dist/* |
| 59 | + git tag -a v1.2.3 -m 'Release 1.2.3' |
| 60 | + git push --tags |
0 commit comments