How To Contribute1
First off, thank you for considering contributing to drf-instamojo
! It's
people like you who make it such a great tool for everyone.
This document intends to make contribution more accessible by codifying tribal knowledge and expectations. Don't be afraid to open half-finished PRs, and ask questions if something is unclear!
- No contribution is too small! Please submit as many fixes for typos and grammar bloopers as you can!
- Try to limit each pull request to one change only.
- Since we squash on merge, it's up to you how you handle updates to the master branch. Whether you prefer to rebase on master or merge master into your branch, do whatever is more comfortable for you.
- Always add tests and docs for your code. This is a hard rule; patches with missing tests or documentation will not be merged.
- Once you've addressed review feedback, make sure to bump the pull request with a short note, so we know you're done.
- Avoid breaking backwards compatibility.
-
Obey PEP 8, PEP 257, and the Google Python Style Guide (mostly)2. We use restructuredtext syntax, and have a summary line starting the
"""
block:def func(x): """Do something. Maybe some more "something" context that can span multiple lines. :param str x: A very important parameter. :rtype: str """
-
We follow reorder_python_imports for sorting our imports. Similar to isort but uses static analysis more, and we follow the Black code style with a line length of 88 characters.
-
Write your asserts as
expected == actual
to line them up nicely:x = f() assert 42 == x.some_attribute assert "foo" == x._a_private_attribute
- Write good test docstrings.
Project-related documentation is written in
restructuredtext (.rst
).
GitHub-related project documentation (e.g. this file you're reading,
CONTRIBUTING.md
) is written in Markdown, as GitHub doesn't support .rst
files for some of their features (e.g. automatically picking up the
CODE_OF_CONDUCT.md
)
-
If you start a new section, add two blank lines before and one blank line after the header, except if two headers follow immediately after each other:
Last line of previous section. Header of New Top Section ------------------------- Header of New Section ^^^^^^^^^^^^^^^^^^^^^ First line of new section.
-
If you add a new feature, demonstrate its awesomeness under
usage.rst
!
First create a virtual environment. It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like pyenv-virtualenv, pew, virtualfish, virtualenvwrapper, and pyenv-virtualenvwrapper.
Next, get an up to date checkout of the drf-instamojo
repository:
$ git clone [email protected]:101loop/drf-instamojo.git
or if you want to use git via https
:
$ git clone https://github.com/101loop/drf-instamojo.git
To avoid committing code that violates our style guide, we advise you to install pre-commit hooks:
(env) $ pre-commit install
You can also run them anytime (as our tox
does, but always run tox
outside
of a virtual environment):
(env) $ pre-commit run --all-files
Please note that this project is released with a Contributor
Code of Conduct.
By participating in this project you agree to abide by its terms. Please report
any harm to devs [at] 101loop.com
for anything you find appropriate.
Thank you for considering contributing to drf-instamojo
!
1: This contribution guide has been taken from interrogate.
2: Do to personal preference, this project differs from Google's style guide in a few ways:
- Instead of using Google's approach for documenting arguments, return/yields, and raises, use restructuredtext syntax as recommended by PEP-0258.
- Instead of
using
pylint
, use flake8. - Instead of using yapf, use Black.