Thanks for helping to make gql awesome!
We welcome all kinds of contributions:
- Bug fixes
- Documentation improvements
- New features
- Refactoring & tidying
If you have a specific contribution in mind, be sure to check the issues and pull requests in progress - someone could already be working on something similar and you can help out.
After cloning this repo, create a virtualenv:
virtualenv gql-dev
Activate the virtualenv and install dependencies by running:
python -m pip install -e.[dev]
If you are using Linux or MacOS, you can make use of Makefile command
make dev-setup
, which is a shortcut for the above python command.
You must create a new env (e.g. gql-dev
) with the following command:
conda create -n gql-dev python=3.8
Then activate the environment with conda activate gql-dev
.
Proceed to install all dependencies by running:
pip install -e.[dev]
And you ready to start development!
Several tools are used to ensure a coherent coding style. You need to make sure that your code satisfy those requirements or the automated tests will fail.
- black code formatter
- flake8 style enforcement
- mypy static type checker
- isort to sort imports alphabetically
On Linux or MacOS, you can fix and check your code style by running
the Makefile command make check
(this is also checked by running
the automated tests with tox but it is much faster with make)
In addition to the above checks, it is asked that:
- type hints are used
- tests are added to ensure complete code coverage
After developing, the full test suite can be evaluated by running:
pytest tests --cov=gql --cov-report=term-missing -vv
Please note that some tests which require external online resources are not done in the automated tests. You can run those tests by running:
pytest tests --cov=gql --cov-report=term-missing --run-online -vv
If you are using Linux or MacOS, you can make use of Makefile commands
make tests
and make all_tests
, which are shortcuts for the above
python commands.
You can also test on several python environments by using tox.
Install tox:
pip install tox
Run tox
on your virtualenv (do not forget to activate it!)
and that's it!
In order to run tox
command on conda, install
tox-conda:
conda install -c conda-forge tox-conda
This install tox underneath so no need to install it before.
Then add the line requires = tox-conda
in the tox.ini
file under [tox]
.
Run tox
and you will see all the environments being created
and all passing tests. 🚀
- Make a fork of the master branch on github
- Clone your forked repo on your computer
- Create a feature branch
git checkout -b feature_my_awesome_feature
- Modify the code
- Verify that the Coding guidelines are respected
- Verify that the automated tests are passing
- Make a commit and push it to your fork
- From github, create the pull request. Automated tests from GitHub actions and codecov will then automatically run the tests and check the code coverage
- If other modifications are needed, you are free to create more commits and push them on your branch. They'll get added to the PR automatically.
Once the Pull Request is accepted and merged, you can safely delete the branch (and the forked repo if no more development is needed).