|
| 1 | +# Contibuting |
| 2 | + |
| 3 | +All contributions to *databases* are welcomed! |
| 4 | + |
| 5 | +## Issues |
| 6 | + |
| 7 | +To make it as simple as possible for us to help you, please include the following: |
| 8 | + |
| 9 | +* OS |
| 10 | +* python version |
| 11 | +* databases version |
| 12 | +* database backend (mysql, sqlite or postgresql) |
| 13 | +* database driver (aiopg, aiomysql etc.) |
| 14 | + |
| 15 | +Please try to always include the above unless you're unable to install *databases* or **know** it's not relevant |
| 16 | +to your question or feature request. |
| 17 | + |
| 18 | +## Pull Requests |
| 19 | + |
| 20 | +It should be quite straight forward to get started and create a Pull Request. |
| 21 | + |
| 22 | +!!! note |
| 23 | + Unless your change is trivial (typo, docs tweak etc.), please create an issue to discuss the change before |
| 24 | + creating a pull request. |
| 25 | + |
| 26 | +To make contributing as easy and fast as possible, you'll want to run tests and linting locally. |
| 27 | + |
| 28 | +You'll need to have **python >= 3.6 (recommended 3.7+)** and **git** installed. |
| 29 | + |
| 30 | +## Getting started |
| 31 | + |
| 32 | +1. Clone your fork and cd into the repo directory |
| 33 | +```bash |
| 34 | +git clone [email protected]: <your username >/databases.git |
| 35 | +cd databases |
| 36 | +``` |
| 37 | + |
| 38 | +2. Create and activate virtual env |
| 39 | +```bash |
| 40 | +virtualenv -p `which python3.6` env |
| 41 | +source env/bin/activate |
| 42 | +``` |
| 43 | + |
| 44 | +3. Install databases, dependencies and test dependencies |
| 45 | +```bash |
| 46 | +pip install -r requirements.txt |
| 47 | +``` |
| 48 | + |
| 49 | +4. Checkout a new branch and make your changes |
| 50 | +```bash |
| 51 | +git checkout -b my-new-feature-branch |
| 52 | +``` |
| 53 | + |
| 54 | +## Make your changes... |
| 55 | + |
| 56 | +## Contribute |
| 57 | + |
| 58 | +1. Formatting and linting - databases uses black for formatting, autoflake for linting and mypy for type hints check |
| 59 | +run all of those with lint script |
| 60 | +```bash |
| 61 | +./scripts/lint |
| 62 | +``` |
| 63 | + |
| 64 | +2. Prepare tests (basic) |
| 65 | + 1. Set-up `TEST_DATABASE_URLS` env variable where you can comma separate urls for several backends |
| 66 | + 2. The simples one is for sqlite alone: `sqlite:///test.db` |
| 67 | + |
| 68 | +3. Prepare tests (all backends) |
| 69 | + 1. In order to run all backends you need a docker instalation on your system [from here](https://docs.docker.com/get-docker/) |
| 70 | + 2. You need to set-up `TEST_IN_DOCKER` env variable (to any non-null value `YES` or `1`) |
| 71 | + |
| 72 | +4. Run tests |
| 73 | +```bash |
| 74 | +./scripts/test |
| 75 | +``` |
| 76 | + |
| 77 | +5. Build documentation |
| 78 | + 1. If you have changed the documentation make sure it runs successfully |
| 79 | +```bash |
| 80 | +./scripts/test |
| 81 | +``` |
| 82 | + |
| 83 | +6. Commit, push, and create your pull request |
0 commit comments