|
| 1 | +# Contributing to Xero-Python |
| 2 | +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: |
| 3 | +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: |
| 4 | + |
| 5 | +We want to make contributing to this project as easy and transparent as possible, whether it's: |
| 6 | + |
| 7 | +The following is a set of guidelines for contributing to Xero and its projects, which are hosted in the [XeroAPI Organization](https://github.com/XeroAPI) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. |
| 8 | + |
| 9 | +### Table Of Contents |
| 10 | +[Code of Conduct](#code-of-conduct) |
| 11 | + |
| 12 | +[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question) |
| 13 | + |
| 14 | +[How Can I Contribute?](#how-can-i-contribute) |
| 15 | + * [Reporting Bugs](#reporting-bugs) |
| 16 | + * [Suggesting Enhancements](#suggesting-enhancements) |
| 17 | + * [Pull Requests](#pull-requests) |
| 18 | + * [Local installation](#local-installation) |
| 19 | + |
| 20 | + |
| 21 | +## Code of Conduct |
| 22 | +Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms. |
| 23 | + |
| 24 | +## I don't want to read this whole thing I just have a question!!! |
| 25 | + |
| 26 | +> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below. |
| 27 | +
|
| 28 | +We have an official [message board](https://community.xero.com/developer) where Xero API support and the community chimes in with helpful advice if you have questions. |
| 29 | + |
| 30 | +* [API Documentation](https://developer.xero.com/documentation/) |
| 31 | +* [Xero FAQ](https://developer.xero.com/faq) |
| 32 | +* [Community, the official Xero message board](https://community.xero.com/developer) |
| 33 | +* [Stackoverflow - Xero related](https://stackoverflow.com/questions/tagged/xero-api?sort=Newest) |
| 34 | +* [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) to our API Support team. |
| 35 | + |
| 36 | +# How Can I Contribute? |
| 37 | + |
| 38 | +You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](README.md) or submitting a pull request. |
| 39 | + |
| 40 | + |
| 41 | +## Reporting Bugs |
| 42 | + |
| 43 | +Bugs are tracked as issues in this repository. |
| 44 | + |
| 45 | +Before opening a new issue: |
| 46 | +* **check [the README](README.md)** to see if the behavior you observed might be expected and if configuration options are available to provide you with the desired behavior. |
| 47 | + |
| 48 | +* **perform a cursory search** to see if there's [an existing issue](https://github.com/xero-github/xero-python/issues) covering your feedback. If there is one and the issue is still open, **add a :+1: reaction** on the issue to express interest in the issue being resolved. That will help the team gauge interest without the noise of comments which trigger notifications to all watchers. Comments should be used only if you have new and useful information to share. |
| 49 | + |
| 50 | +### Write bug reports with detail, background, and sample code |
| 51 | + |
| 52 | +- Which version of the SDK are you using? |
| 53 | +- A quick summary and/or background |
| 54 | +- Steps to reproduce |
| 55 | + - Be specific! |
| 56 | + - Give sample code if you can. |
| 57 | +- What you expected would happen |
| 58 | +- What actually happens |
| 59 | +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) |
| 60 | + |
| 61 | +## Suggesting Enhancements |
| 62 | + |
| 63 | +When opening an issue for a feature request: |
| 64 | +* **use a clear and descriptive title** for the issue to identify the problem. |
| 65 | +* **include as many details as possible in the body**. Explain your use-case, the problems you're hitting and the solutions you'd like to see to address those problems. |
| 66 | + |
| 67 | +## Pull requests |
| 68 | + |
| 69 | +We welcome your feedback and pull requests. Be aware some code is generated and pull requests may not be the best solution - see below. |
| 70 | + |
| 71 | +### We Use OpenAPI Generator |
| 72 | +The best way to propose changes to the codebase is to open an [issue](https://github.com/XeroAPI/xero-python/issues) and discuss with our team. |
| 73 | + |
| 74 | +We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) and [our OpenAPI specs](https://github.com/XeroAPI/Xero-OpenAPI), to create and update our models and client classes. Improvements may require updates to our OAS or our customized mustache templates instead of modifying via pull request. |
| 75 | + |
| 76 | +### Submit a pull request |
| 77 | + |
| 78 | +1. Fork and clone the repository |
| 79 | +1. Create a new branch: `git checkout -b my-branch-name` |
| 80 | +1. Make your change, add tests if needed |
| 81 | +1. Make sure the tests pass on your machine: `tox` read more in [local installation](#local-installation). |
| 82 | +1. Push to your fork and submit a pull request |
| 83 | +1. Pat your self on the back and wait for your pull request to be reviewed and merged. |
| 84 | + |
| 85 | +Here are a few things you can do that will increase the likelihood of your pull request being accepted: |
| 86 | + |
| 87 | +- Follow the [style guide](#style-guide). |
| 88 | +- Write tests. |
| 89 | +- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. |
| 90 | +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). |
| 91 | + |
| 92 | +### Style Guide |
| 93 | + |
| 94 | +* 4 spaces for indentation rather than tabs |
| 95 | +* See [.editorconfig](.editorconfig) for more styling rules |
| 96 | +* We us [black](https://github.com/psf/black) code formatter and |
| 97 | + [flake8](https://flake8.pycqa.org/en/latest/) to enforce style requirements. |
| 98 | +* Activate virtual environment by running `source venv/bin/activate` |
| 99 | +* Execute `flake8 xero_python tests` to check your code passes style requirements. |
| 100 | +* If you see `BLK100 Black would make changes.` error Execute `black <file/path.py>` to correct it. |
| 101 | + |
| 102 | +### Local development requirements |
| 103 | + |
| 104 | +* Python3.5+ installed. |
| 105 | + |
| 106 | +### Local installation |
| 107 | + |
| 108 | +* To speed up local tests install [libyaml](https://pyyaml.org/wiki/LibYAML) library. |
| 109 | + ```bash |
| 110 | + brew install libyaml # Mac with Homebrew |
| 111 | + apt-get install libyaml-dev # Ubuntu |
| 112 | + dnf install libyaml-devel # Fedora |
| 113 | + ``` |
| 114 | +* Create new python virtual environment `python3 -m venv venv` |
| 115 | +* Activate new virtual environment by running `source venv/bin/activate` |
| 116 | +* Install project dependencies by running `pip install -r requirements.txt -r requirements/dev.txt` |
| 117 | + |
| 118 | +### Running tests |
| 119 | +* Activate virtual environment by running `source venv/bin/activate` |
| 120 | +* Execute `pytest` to run tests. |
| 121 | + |
| 122 | +### Running tests for all python versions |
| 123 | +* We use [tox](https://tox.readthedocs.io/en/latest/) to create different python environments and execute tests. |
| 124 | + |
| 125 | +#### Local installation requirements |
| 126 | +* You need to have python interpreters for python 3.5, 3.6, 3.7, and 3.8 installed locally. |
| 127 | +* You can install them using [pyenv](https://github.com/pyenv/pyenv) |
| 128 | +* Install `pyenv` - follow https://github.com/pyenv/pyenv#installation |
| 129 | +* Install python versions required |
| 130 | + ```bash |
| 131 | + pyenv install 3.5.9 && \ |
| 132 | + pyenv install 3.6.10 && \ |
| 133 | + pyenv install 3.7.6 && \ |
| 134 | + pyenv install 3.8.2 |
| 135 | + ``` |
| 136 | + |
| 137 | +#### Running all tests |
| 138 | +* Activate pyenv installed python versions `pyenv local 3.5.9 3.6.10 3.7.6 3.8.2` |
| 139 | +* Activate virtual environment by running `source venv/bin/activate` |
| 140 | +* Execute `tox` to run all tests in all python versions |
| 141 | + |
| 142 | +## License |
| 143 | +By contributing, you agree that your contributions will be licensed under its MIT License. |
0 commit comments