1# How to Contribute
2
3We'd love to accept your patches and contributions to this project. There are
4just a few small guidelines you need to follow.
5
6NOTE: If you are new to GitHub, please start by reading the [Pull Request
7howto](https://help.github.com/articles/about-pull-requests/).
8
9## Contributor License Agreement
10
11Contributions to this project must be accompanied by a Contributor License
12Agreement. You (or your employer) retain the copyright to your contribution,
13this simply gives us permission to use and redistribute your contributions as
14part of the project. Head over to <https://cla.developers.google.com/> to see
15your current agreements on file or to sign a new one.
16
17You generally only need to submit a CLA once, so if you've already submitted one
18(even if it was for a different project), you probably don't need to do it
19again.
20
21## Coding Style
22
23To keep the source consistent, readable, diffable and easy to merge, we use a
24fairly rigid coding style, as defined by the
25[google-styleguide](https://github.com/google/styleguide) project. All patches
26will be expected to conform to the Python style outlined
27[here](https://google.github.io/styleguide/pyguide.html).
28
29## Guidelines for Pull Requests
30
31*   Create **small PRs** that are narrowly focused on **addressing a single
32    concern**. We often receive PRs that are trying to fix several things at a
33    time, but if only one fix is considered acceptable, nothing gets merged and
34    both author's & review's time is wasted. Create more PRs to address
35    different concerns and everyone will be happy.
36
37*   For speculative changes, consider opening an
38    [issue](https://github.com/abseil/abseil-py/issues) and discussing it first.
39
40*   Provide a good **PR description** as a record of **what** change is being
41    made and **why** it was made. Link to a GitHub issue if it exists.
42
43*   Don't fix code style and formatting unless you are already changing that
44    line to address an issue. PRs with irrelevant changes won't be merged. If
45    you do want to fix formatting or style, do that in a separate PR.
46
47*   Unless your PR is trivial, you should expect there will be reviewer comments
48    that you'll need to address before merging. We expect you to be reasonably
49    responsive to those comments, otherwise the PR will be closed after 2-3
50    weeks of inactivity.
51
52*   Maintain **clean commit history** and use **meaningful commit messages**.
53    PRs with messy commit history are difficult to review and won't be merged.
54    Use `rebase -i upstream/main` to curate your commit history and/or to
55    bring in latest changes from main (but avoid rebasing in the middle of a
56    code review).
57
58*   Keep your PR up to date with upstream/main (if there are merge conflicts,
59    we can't really merge your change).
60
61*   **All tests need to be passing** before your change can be merged. We
62    recommend you **run tests locally** (see
63    [Running Tests](README.md#running-tests)).
64
65*   Exceptions to the rules can be made if there's a compelling reason for doing
66    so. That is - the rules are here to serve us, not the other way around, and
67    the rules need to be serving their intended purpose to be valuable.
68
69*   All submissions, including submissions by project members, require review.
70