👏 First off, thank you for taking the time to contribute. 👏
- Fork the repository
- Create a new branch on your fork
- Commit your changes
- Create a pull request against the
dev
branch
Early-access image deployed to GitHub container registry:
docker run -d -p 8000:8000 --name switcher_webapi ghcr.io/tomerfi/switcher_webapi:early-access
Docker multi-platform image running a Python web app. The doc site is built with Mkdocs.
- app/webapp.py the application file
- app/tests/ unit tests
- Dockerfile image instructions
- docs sources for the documentation site
The released image is deployed to Docker hub.
Run commands using tox:
# Run linters and tests
tox -e test
# Generate the docs site
tox -e docs
# Serve the docs site
tox -e docs-serve
If you need to work inside the development environment, keep reading.
Prepare the environment:
tox
Update the environment:
tox -r
Activate the environment:
source .tox/dev/bin/activate
Deactivate the environment:
deactivate
Running tests and linters is done using (pytest takes positional arguments):
# run all tests
tox -e test
# run a specific test
tox -e test -- -k "test_name_goes_here"
If you need to work inside the development environment, prepare the environment.
Run the various linters inside the environment:
black --check app/
flake8 --count --statistics app/
isort --check-only app/
mypy --ignore-missing-imports app/
yamllint --format colored --strict .
Run tests inside the environment:
# run all tests
pytest -v
# run a specific test
tox -e test -- -k "test_name_goes_here"
# run tests and print coverage summary to stdout
pytest -v --cov --cov-report term-missing
# run tests and create coverage report
pytest -v --cov --cov-report=html
Generating or serving the docs is done using:
# generate the docs site
tox -e docs
# generate and serve the docs site
tox -e docs-serve
If you need to work inside the development environment, prepare the environment.
Generate the site inside the environment:
mkdocs build
Generate and serve the site from within the environment:
tox -e docs-serve
Lint the Dockerfile:
make dockerfile-lint
Configure qemu for multi-platform builds:
make enable-multiarch
Builds the multi-platform image using docker buildx
:
make build