Skip to content

Commit 8b68ec9

Browse files
sumit4613restyled-io[bot]restyled-commits
authored
Add contributing guide, code of conduct and issue templates (#11)
* add contributing guide and code of conduct * add issue template * add pull request template * fix typo in pull request template * Restyled by prettier-markdown (#12) Co-authored-by: Restyled.io <[email protected]> Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: Restyled.io <[email protected]>
1 parent dd4eb3c commit 8b68ec9

File tree

5 files changed

+380
-0
lines changed

5 files changed

+380
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve drf-user <3
4+
title: ''
5+
labels: bug, needs triage
6+
assignees: sumit4613
7+
8+
---
9+
10+
### Environment
11+
<!-- Please include if you've confirmed one version of something works while another one does not -->
12+
- `drf-user` version(s) (`drf-user --version`:
13+
- Operating System(s):
14+
- Python version(s):
15+
16+
### Description of the bug
17+
<!-- A clear and concise description of what the bug is. -->
18+
19+
### What you expected to happen
20+
<!-- A clear and concise description of what you expected to happen. -->
21+
22+
### How to reproduce (as minimally and precisely as possible)
23+
<!-- If applicable, add screenshots to help explain your problem. -->
24+
25+
### Anything else we need to know?
26+
<!-- Add any other context about the problem here. -->
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for drf-user
4+
title: ''
5+
labels: enhancement, needs triage
6+
assignees: sumit4613
7+
8+
---
9+
10+
### Describe the feature you'd like
11+
<!-- A clear and concise description of what you want to happen. -->
12+
<!-- Got some time on your hands and want to contribute a patch? You're freaking awesome! Please include that below. -->
13+
14+
### Is your feature request related to a problem?
15+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
16+
17+
### Your Environment
18+
<!-- It can help for us to know how you're using interrogate -->
19+
- `drf-user` version(s) (`drf-user --version`:
20+
- Operating System(s):
21+
- Python version(s):
22+
23+
### Additional context
24+
<!-- Add any other context or screenshots about the feature request here. -->

.github/pull_request_template.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Hey, I just made a Pull Request!
2+
3+
## Description
4+
<!--- Describe your changes -->
5+
6+
## Motivation and Context
7+
<!--- Why is this change required? What problem does it solve? -->
8+
<!--- If it fixes an open issue, please link to the issue here. -->
9+
10+
## Have you tested this? If so, how?
11+
<!--- Valid responses are "I have included unit tests." and -->
12+
<!--- "I ran `drf-user` with these changes over some code and it works for me." -->
13+
14+
## Checklist for PR author(s)
15+
<!-- If an item doesn't apply to your pull request, **check it anyway** to make it apparent that there's nothing left to do. -->
16+
- [ ] Changes are covered by unit tests (no major decrease in code coverage %).
17+
- [ ] All tests pass.
18+
- [ ] Docstring coverage is **100%** via `interrogate drf_user` (I mean, we _should_ set a good example :smile:).
19+
- [ ] Updates to documentation:
20+
- [ ] Document any relevant additions/changes in `README.md`.
21+
- [ ] Manually update **both** the `README.md` _and_ `docs/index.rst` for any new changes.
22+
- [ ] Any changed/added classes/methods/functions have appropriate `versionadded`, `versionchanged`, or `deprecated` [directives](http://www.sphinx-doc.org/en/stable/markup/para.html#directive-versionadded). Find the appropriate next version in the project's [``__init__.py``](https://github.com/101loop/drf-user/blob/master/drf_user/__init__.py) file.
23+
24+
## Release note
25+
<!-- If your change is non-trivial (e.g. more than a fixed typo in docs, or updated tests), please write a suggested release note for us to include in `docs/changelog.rst` (we may edit it a bit).
26+
27+
1. Enter your release note in the below block. If the PR requires additional action from users switching to the new release, start the release note with the string "action required: ". Please write it in the imperative.
28+
2. If no release note is required, just write "NONE".
29+
-->
30+
```release-note
31+
32+
```
33+
34+
<!---
35+
for more information on how to submit valuable contributions,
36+
see https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution
37+
-->

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of
9+
experience, nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at `devs [at] 101loop.com`. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
64+
65+
Project maintainers who do not follow or enforce the Code of Conduct in good
66+
faith may face temporary or permanent repercussions as determined by other
67+
members of the project's leadership.
68+
69+
## Attribution
70+
71+
This Code of Conduct is adapted from the
72+
[Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
73+
available at
74+
[https://www.contributor-covenant.org/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).

CONTRIBUTING.md

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# How To Contribute<sup>[1](#footnote-1)</sup>
2+
3+
First off, thank you for considering contributing to `drf-user`! It's people
4+
like _you_ who make it such a great tool for everyone.
5+
6+
This document intends to make contribution more accessible by codifying tribal
7+
knowledge and expectations. Don't be afraid to open half-finished PRs, and ask
8+
questions if something is unclear!
9+
10+
## Workflow
11+
12+
- No contribution is too small! Please submit as many fixes for typos and
13+
grammar bloopers as you can!
14+
- Try to limit each pull request to **_one_** change only.
15+
- Since we squash on merge, it's up to you how you handle updates to the master
16+
branch. Whether you prefer to rebase on master or merge master into your
17+
branch, do whatever is more comfortable for you.
18+
- _Always_ add tests and docs for your code. This is a hard rule; patches with
19+
missing tests or documentation will not be merged.
20+
<!-- * Make sure your changes pass our [CI](https://github.com/101loop/drf-user/actions?query=workflow%3ACI). You won't get any feedback until it's green unless you ask for it. -->
21+
- Once you've addressed review feedback, make sure to bump the pull request with
22+
a short note, so we know you're done.
23+
- Avoid breaking backwards compatibility.
24+
25+
## Code
26+
27+
- Obey [PEP 8](https://www.python.org/dev/peps/pep-0008/),
28+
[PEP 257](https://www.python.org/dev/peps/pep-0257/), and the
29+
[Google Python Style Guide](http://google.github.io/styleguide/pyguide.html)
30+
(mostly)<sup>[2](#footnote-2)</sup>. We use
31+
[restructuredtext](https://docutils.sourceforge.io/rst.html) syntax, and have
32+
a summary line starting the `"""` block:
33+
34+
```python
35+
def func(x):
36+
"""Do something.
37+
38+
Maybe some more "something" context that can span
39+
multiple lines.
40+
41+
:param str x: A very important parameter.
42+
:rtype: str
43+
"""
44+
```
45+
46+
- We follow
47+
[reorder_python_imports](https://github.com/asottile/reorder_python_imports) for
48+
sorting our imports. Similar to [isort](https://github.com/timothycrosley/isort)
49+
but uses static analysis more, and we follow the
50+
[Black](https://github.com/psf/black) code style with a line length of 88
51+
characters.
52+
<!-- As long as you run our full tox suite before committing, or install our [pre-commit](https://pre-commit.com/) hooks (ideally you'll do both -- see [Local Development Environment](#local-development-environment)), you won't have to spend any time on formatting your code at all. If you don't, CI will catch it for you -- but that seems like a waste of your time! -->
53+
54+
## Tests
55+
56+
- Write your asserts as `expected == actual` to line them up nicely:
57+
58+
```python
59+
60+
x = f()
61+
62+
assert 42 == x.some_attribute
63+
assert "foo" == x._a_private_attribute
64+
```
65+
66+
<!-- * To run the test suite, all you need is a recent [tox](https://tox.readthedocs.io/). It will ensure the test suite runs with all dependencies against all Python versions just as it will in our CI. If you lack some Python versions, you can can always limit the environments like ``tox -e py35,py36`` (in that case you may want to look into [pyenv](https://github.com/pyenv/pyenv), which makes it very easy to install many different Python versions in parallel). -->
67+
68+
- Write [good test docstrings](https://jml.io/pages/test-docstrings.html).
69+
70+
## Documentation
71+
72+
Project-related documentation is written in
73+
[restructuredtext](https://docutils.sourceforge.io/rst.html) (`.rst`).
74+
GitHub-related project documentation (e.g. this file you're reading,
75+
`CONTRIBUTING.md`) is written in Markdown, as GitHub doesn't support `.rst`
76+
files for some of their features (e.g. automatically picking up the
77+
`CODE_OF_CONDUCT.md`)
78+
79+
- If you start a new section, add two blank lines before and one blank line
80+
after the header, except if two headers follow immediately after each other:
81+
82+
```rst
83+
Last line of previous section.
84+
85+
Header of New Top Section
86+
-------------------------
87+
88+
Header of New Section
89+
^^^^^^^^^^^^^^^^^^^^^
90+
91+
First line of new section.
92+
```
93+
94+
- If you add a new feature, demonstrate its awesomeness under `usage.rst`!
95+
96+
## Local Development Environment
97+
98+
<!-- You can (and should) run our test suite using [tox](https://tox.readthedocs.io/). However, you’ll probably want a more traditional environment as well. We highly recommend to develop using the latest Python 3 release because `interrogate` tries to take advantage of modern features whenever possible. -->
99+
100+
First create a [virtual environment](https://virtualenv.pypa.io/). It’s out of
101+
scope for this document to list all the ways to manage virtual environments in
102+
Python, but if you don’t already have a pet way, take some time to look at tools
103+
like [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv),
104+
[pew](https://github.com/berdario/pew),
105+
[virtualfish](https://virtualfish.readthedocs.io/),
106+
[virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/), and
107+
[pyenv-virtualenvwrapper](https://github.com/pyenv/pyenv-virtualenvwrapper).
108+
109+
Next, get an up to date checkout of the `drf-user` repository:
110+
111+
```sh
112+
$ git clone [email protected]:101loop/drf-user.git
113+
```
114+
115+
or if you want to use git via `https`:
116+
117+
```sh
118+
$ git clone https://github.com/101loop/drf-user.git
119+
```
120+
121+
<!-- Change into the newly created directory and **after activating your virtual environment** install an editable version of `interrogate` along with its tests and docs requirements:
122+
123+
```sh
124+
(env) $ cd drf-user
125+
(env) $ pip install -e '.[dev]'
126+
```
127+
128+
At this point,
129+
130+
```sh
131+
(env) $ python -m pytest
132+
```
133+
134+
should work and pass, as should:
135+
136+
```sh
137+
(env) $ cd docs
138+
(env) $ make livehtml
139+
```
140+
141+
The built documentation can then be found in [`localhost:8888`](http://localhost:8888).
142+
143+
To avoid committing code that violates our style guide, we advise you to install
144+
[pre-commit](https://pre-commit.com/) hooks:
145+
146+
```sh
147+
(env) $ pre-commit install
148+
```
149+
150+
You can also run them anytime (as our `tox` does, but always run `tox` outside
151+
of a virtual environment):
152+
153+
```sh
154+
(env) $ pre-commit run --all-files
155+
```
156+
-->
157+
158+
Install your local copy into a virtualenv. Assuming you have already created
159+
virtualenv, this is how you set up your fork for local development:
160+
161+
```sh
162+
(env) $ cd drf-user
163+
(env) $ make install
164+
```
165+
166+
Create a branch for local development:
167+
168+
```sh
169+
$ git checkout -b name-of-your-bugfix-or-feature
170+
```
171+
172+
Now you can make your changes locally.
173+
174+
When you're done making changes, check that your changes pass tests and code
175+
style should be aligned with Flake8 and Black:
176+
177+
```sh
178+
$ make test-coverage
179+
$ make lint
180+
$ make format
181+
```
182+
183+
Commit your changes and push your branch to GitHub:
184+
185+
```sh
186+
$ git add .
187+
$ git commit -m "Your detailed description of your changes."
188+
$ git push origin name-of-your-bugfix-or-feature
189+
```
190+
191+
Submit a pull request through the GitHub website.
192+
193+
## Code of Conduct
194+
195+
Please note that this project is released with a Contributor
196+
[Code of Conduct](https://github.com/101loop/drf-user/blob/master/CODE_OF_CONDUCT.md).
197+
By participating in this project you agree to abide by its terms. Please report
198+
any harm to `devs [at] 101loop.com` for anything you find appropriate.
199+
200+
Thank you for considering contributing to `drf-user`!
201+
202+
---
203+
204+
<a name="footnote-1">1</a>: This contribution guide has been taken from
205+
[interrogate](https://github.com/econchick/interrogate/).
206+
207+
<a name="footnote-2">2</a>: Do to personal preference, this project differs from
208+
Google's style guide in a few ways:
209+
210+
- Instead of using Google's approach for documenting
211+
[arguments, return/yields, and raises](http://google.github.io/styleguide/pyguide.html#383-functions-and-methods),
212+
use [restructuredtext](https://docutils.sourceforge.io/rst.html) syntax as
213+
recommended by [PEP-0258](https://www.python.org/dev/peps/pep-0258/).
214+
- Instead of
215+
[using `pylint`](http://google.github.io/styleguide/pyguide.html#21-lint), use
216+
[flake8](https://flake8.pycqa.org/en/latest/).
217+
- Instead of
218+
[using yapf](http://google.github.io/styleguide/pyguide.html#1-background),
219+
use [Black](https://github.com/psf/black).

0 commit comments

Comments
 (0)