| 1 |
# Contribution Guidelines |
| 2 |
|
| 3 |
We gladly accept outside contributions. We use our |
| 4 |
[Github issue tracker](https://github.com/python-zk/kazoo/issues) |
| 5 |
for both discussions and talking about new features or bugs. You can |
| 6 |
also fork the project and sent us a pull request. If you have a more |
| 7 |
general topic to discuss, the |
| 8 |
[[email protected]](https://zookeeper.apache.org/lists.html) |
| 9 |
mailing list is a good place to do so. You can sometimes find us on |
| 10 |
IRC in the |
| 11 |
[#zookeeper channel on freenode](https://zookeeper.apache.org/irc.html). |
| 12 |
|
| 13 |
[See the README](/README.rst) for contact information. |
| 14 |
|
| 15 |
## Development |
| 16 |
|
| 17 |
If you want to work on the code and send us a |
| 18 |
[pull request](https://help.github.com/articles/using-pull-requests), |
| 19 |
first fork the repository on github to your own account. Then clone |
| 20 |
your new repository and run the build scripts: |
| 21 |
|
| 22 |
``` |
| 23 |
git clone [email protected]:<username>/kazoo.git |
| 24 |
cd kazoo |
| 25 |
make |
| 26 |
``` |
| 27 |
|
| 28 |
You need a supported version of Python installed and available as `python` |
| 29 |
in your shell. To run Zookeeper you also need a Java runtime (JRE or JDK). |
| 30 |
Please refer to the Zookeeper documentation for compatible Java versions for |
| 31 |
each Zookeeper version. To run tests, you need to have `tox`, the Python |
| 32 |
testing tool, installed in your shell. |
| 33 |
|
| 34 |
You can run all the tests by calling: |
| 35 |
|
| 36 |
``` |
| 37 |
make test |
| 38 |
``` |
| 39 |
|
| 40 |
Or to run individual tests: |
| 41 |
|
| 42 |
``` |
| 43 |
export ZOOKEEPER_PATH=/<path to current folder>/bin/zookeeper/ |
| 44 |
bin/pytest -v kazoo/tests/test_client.py::TestClient::test_create |
| 45 |
``` |
| 46 |
|
| 47 |
The pytest test runner allows you to filter by test module, class or |
| 48 |
individual test method. |
| 49 |
|
| 50 |
If you made changes to the documentation, you can build it locally: |
| 51 |
|
| 52 |
``` |
| 53 |
make html |
| 54 |
``` |
| 55 |
|
| 56 |
And then open `./docs/_build/html/index.html` in a web browser to |
| 57 |
verify the correct rendering. |
| 58 |
|
| 59 |
|
| 60 |
## Bug Reports |
| 61 |
|
| 62 |
You can file issues here on GitHub. Please try to include as much information as |
| 63 |
you can and under what conditions you saw the issue. |
| 64 |
|
| 65 |
## Adding Recipes |
| 66 |
|
| 67 |
New recipes are welcome, however they should include the status/maintainer |
| 68 |
RST information so its clear who is maintaining the recipe. This means |
| 69 |
that if you submit a recipe for inclusion with Kazoo, you should be ready |
| 70 |
to support/maintain it, and address bugs that may be found. |
| 71 |
|
| 72 |
Ideally a recipe should have at least two maintainers. |
| 73 |
|
| 74 |
## Sending Pull Requests |
| 75 |
|
| 76 |
Patches should be submitted as pull requests (PR). |
| 77 |
|
| 78 |
Before submitting a PR: |
| 79 |
- Your code must run and pass all the automated tests before you submit your PR |
| 80 |
for review. "Work in progress" pull requests are allowed to be submitted, but |
| 81 |
should be clearly labeled as such and should not be merged until all tests |
| 82 |
pass and the code has been reviewed. |
| 83 |
- Your patch should include new tests that cover your changes. It is your and |
| 84 |
your reviewer's responsibility to ensure your patch includes adequate tests. |
| 85 |
|
| 86 |
When submitting a PR: |
| 87 |
- You agree to license your code under the project's open source license |
| 88 |
([APL 2.0](/LICENSE)). |
| 89 |
- Base your branch off the current `master`. |
| 90 |
- Add both your code and new tests if relevant. |
| 91 |
- Sign your git commit. |
| 92 |
- Run the test suite to make sure your code passes linting and tests. |
| 93 |
- Ensure your changes do not reduce code coverage of the test suite. |
| 94 |
- Please do not include merge commits in pull requests; include only commits |
| 95 |
with the new relevant code. |
| 96 |
|
| 97 |
|
| 98 |
## Code Review |
| 99 |
|
| 100 |
This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. |
| 101 |
|
| 102 |
## Git Commit Guidelines |
| 103 |
|
| 104 |
We loosely follow the [Angular commit guidelines](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#type) |
| 105 |
of `<type>(scope): <subject>` where `type` must be one of: |
| 106 |
|
| 107 |
* **feat**: A new feature |
| 108 |
* **fix**: A bug fix |
| 109 |
* **docs**: Documentation only changes |
| 110 |
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing |
| 111 |
semi-colons, etc) |
| 112 |
* **refactor**: A code change that neither fixes a bug or adds a feature |
| 113 |
* **perf**: A code change that improves performance |
| 114 |
* **test**: Adding missing tests |
| 115 |
* **chore**: Changes to the build process or auxiliary tools and libraries such as documentation |
| 116 |
generation |
| 117 |
|
| 118 |
Scope may be left off if none of these components are applicable: |
| 119 |
|
| 120 |
* **core**: Core client/connection handling |
| 121 |
* **recipe**: Changes/Fixes/Additions to recipes |
| 122 |
|
| 123 |
### Subject |
| 124 |
|
| 125 |
The subject contains succinct description of the change: |
| 126 |
|
| 127 |
* use the imperative, present tense: "change" not "changed" nor "changes" |
| 128 |
* don't capitalize first letter |
| 129 |
* no dot (.) at the end |
| 130 |
|
| 131 |
### Body |
| 132 |
|
| 133 |
In order to maintain a reference to the context of the commit, add |
| 134 |
`closes #<issue_number>` if it closes a related issue or `issue #<issue_number>` |
| 135 |
if it's a partial fix. |
| 136 |
|
| 137 |
You can also write a detailed description of the commit. Just as in the |
| 138 |
**subject**, use the imperative, present tense: "change" not "changed" nor |
| 139 |
"changes". Please include the motivation for the change and contrast this with |
| 140 |
previous behavior. |
| 141 |
|
| 142 |
### Footer |
| 143 |
|
| 144 |
The footer should contain any information about **Breaking Changes** and is also |
| 145 |
the place to reference GitHub issues that this commit **Closes**. |
| 146 |
|
| 147 |
### Example |
| 148 |
|
| 149 |
A properly formatted commit message should look like: |
| 150 |
|
| 151 |
``` |
| 152 |
feat(core): add tasty cookies to the client handler |
| 153 |
|
| 154 |
Properly formatted commit messages provide understandable history and |
| 155 |
documentation. This patch will provide a delicious cookie when all tests have |
| 156 |
passed and the commit message is properly formatted. |
| 157 |
|
| 158 |
BREAKING CHANGE: This patch requires developer to lower expectations about |
| 159 |
what "delicious" and "cookie" may mean. Some sadness may result. |
| 160 |
|
| 161 |
Closes #3.14, #9.75 |
| 162 |
``` |
| 163 |
|
| 164 |
# Legal |
| 165 |
|
| 166 |
Currently we don't have any legal contributor agreement, so code |
| 167 |
ownership stays with the original authors. |