|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for helping to make graphql-server-core awesome! |
| 4 | + |
| 5 | +We welcome all kinds of contributions: |
| 6 | + |
| 7 | +- Bug fixes |
| 8 | +- Documentation improvements |
| 9 | +- New features |
| 10 | +- Refactoring & tidying |
| 11 | + |
| 12 | + |
| 13 | +## Getting started |
| 14 | + |
| 15 | +If you have a specific contribution in mind, be sure to check the [issues](https://github.com/graphql-python/graphql-server-core/issues) and [pull requests](https://github.com/graphql-python/graphql-server-core/pulls) in progress - someone could already be working on something similar and you can help out. |
| 16 | + |
| 17 | + |
| 18 | +## Project setup |
| 19 | + |
| 20 | +### Development with virtualenv (recommended) |
| 21 | + |
| 22 | +After cloning this repo, create a virtualenv: |
| 23 | + |
| 24 | +```console |
| 25 | +virtualenv graphql-server-core-dev |
| 26 | +``` |
| 27 | + |
| 28 | +Activate the virtualenv and install dependencies by running: |
| 29 | + |
| 30 | +```console |
| 31 | +python pip install -e ".[test]" |
| 32 | +``` |
| 33 | + |
| 34 | +If you are using Linux or MacOS, you can make use of Makefile command |
| 35 | +`make dev-setup`, which is a shortcut for the above python command. |
| 36 | + |
| 37 | +### Development on Conda |
| 38 | + |
| 39 | +You must create a new env (e.g. `graphql-sc-dev`) with the following command: |
| 40 | + |
| 41 | +```sh |
| 42 | +conda create -n graphql-sc-dev python=3.8 |
| 43 | +``` |
| 44 | + |
| 45 | +Then activate the environment with `conda activate graphql-sc-dev`. |
| 46 | + |
| 47 | +Proceed to install all dependencies by running: |
| 48 | + |
| 49 | +```console |
| 50 | +pip install -e.[dev] |
| 51 | +``` |
| 52 | + |
| 53 | +And you ready to start development! |
| 54 | + |
| 55 | +## Running tests |
| 56 | + |
| 57 | +After developing, the full test suite can be evaluated by running: |
| 58 | + |
| 59 | +```sh |
| 60 | +pytest tests --cov=graphql-server-core -vv |
| 61 | +``` |
| 62 | + |
| 63 | +If you are using Linux or MacOS, you can make use of Makefile command |
| 64 | +`make tests`, which is a shortcut for the above python command. |
| 65 | + |
| 66 | +You can also test on several python environments by using tox. |
| 67 | + |
| 68 | +### Running tox on virtualenv |
| 69 | + |
| 70 | +Install tox: |
| 71 | + |
| 72 | +```console |
| 73 | +pip install tox |
| 74 | +``` |
| 75 | + |
| 76 | +Run `tox` on your virtualenv (do not forget to activate it!) |
| 77 | +and that's it! |
| 78 | + |
| 79 | +### Running tox on Conda |
| 80 | + |
| 81 | +In order to run `tox` command on conda, install |
| 82 | +[tox-conda](https://github.com/tox-dev/tox-conda): |
| 83 | + |
| 84 | +```sh |
| 85 | +conda install -c conda-forge tox-conda |
| 86 | +``` |
| 87 | + |
| 88 | +This install tox underneath so no need to install it before. |
| 89 | + |
| 90 | +Then uncomment the `requires = tox-conda` line on `tox.ini` file. |
| 91 | + |
| 92 | +Run `tox` and you will see all the environments being created |
| 93 | +and all passing tests. :rocket: |
| 94 | + |
0 commit comments