The following is a set of best practices for contributing to the operator-courier project. For any questions or concerns please reach out to the AOS-Marketplace team: aos-marketplace@redhat.com
This project uses pipenv to manage dependencies and create virtual environments for development environment.
Python3
sudo dnf install python3
pipenv
sudo dnf install pipenv
tox
sudo dnf install tox
To test the package locally, we need to install dependent pip packages in a way that does not make modifications to the local environment. To achieve this, start a pipenv
shell
pipenv shell
Inside this environment all of the dependent packages are installed without polluting the local environment. For more detailed info, take a look at their (pipenv's) starter documentation.
Changes submitted to this project should follow PEP8 recommendations.
We use flake8, a wrapper around
PyFlakes, PyCodeStyle and McCabe, for checking coding style. You might want to
read the documentation on the error
codes, and check the
project specific configuration found in the [flake8]
section of tox.ini
.
As flake8
is part of the default tox envlist, code style is checked whenever
tox
is run.
This project uses tox for running the tests, in order to ensure the consistency of the test environments, and make testing with multiple Python versions (3.6 and 3.7) easier.
After changes in tox.ini
or major changes in the working tree (after
switching branches or pulling from others), it is recommended to use the
--recreate
option when running tox
, to ensure that the test environments
are up to date.
Coverage is measured using pytest-cov,
and it's configured to fail the tests in case the coverage drops bellow a
certain level. This is intended to ensure that all code changes submitted to
this project are appropriately unit tested. For the current value, see the
[coverage:report]
section in tox.ini
.
In order to run integration tests for the push
command, you will need to set
QUAY_NAMESPACE
and QUAY_ACCESS_TOKEN
environment variables locally, or add
them to tox.ini, for example
setenv =
QUAY_NAMESPACE = my_quay_namespace
QUAY_ACCESS_TOKEN = basic aBcDeFaBcDeFaBcDeFaBcDeFaBcDeF==
You can use the Makefile that simplifies those processes
-
To create a source distribution and a build distribution of the project
make release
-
To upload the project to PyPI
make deploy
-
To clean up artifacts generated by
make release
commandmake clean