Contributing¶
Contributing has a few additional steps that may require some explanation for first-time users. Here, we’ll give you step-by-step instructions on how to setup github for contributing to this project, how to format your code changes and how to generate updated documentation.
A few extra packages are required when contributing to QWAK:
pip install autopep8 pytest bumpver
Autopep8 formats code according to the PEP 8 style. Pytest is responsible for unit testing the package to assure everything working correctly after a change. Bumpver manages package versioning.
Table of Contents
Setting up the repo for contributing¶
Install git.
Fork the QWAK repository to your account so you can work on own copy. This will allow you to open Pull Requests later.
Add the upstream repository:
git remote add upstream https://github.com/JaimePSantos/QWAK.git
Update your fork with:
git checkout main
Followed by:
git pull --rebase upstream main
This should be done somewhat regularly to ensure your fork is up-to-date with the most recent QWAK version.
Follow QWAK’s installation instructions in case you haven’t installed the package yet.
pip install -e .
This should be used to install your package in editable mode.
Making your changes¶
Checkout and sync your main branch with the upstream to reflect the newest version:
git checkout main git pull --rebase upstream main
Create a new branch to work on instead of main:
git checkout -b <new_branch_name> upstream/main
If this is the first time you’re building the package:
python -m pip install --upgrade build python -m build
This might not be needed, will test in the future and update the docs accordingly.
Make your changes.
Ensure your changes does not break the existing code by running the following command inside the main project folder:
pytest -v tests/
If all the tests are successfull, format your changed files with:
autopep8 --in-place --aggressive --aggressive --max-line-length 72 <path_to_file>
Or, alternatively an entire folder with:
autopep8 --recursive --in-place --aggressive --aggressive --max-line-length 72 <path_to_folder>
In case a version bump is required:
bumpver update --patch
Commit your changes:
git commit -am <commit message>
Make sure you write a short descriptive message so that the changes on the commit can be easily identified.
Push your changes to your fork:
git push -u origin <branch name>
Visit your repo on github and create a pull request to the main repo!