👏 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
An early-access image manifest is deployed to ghcr.io
for every merge to the default branch, dev
:
docker run -d -p 8000:8000 --name switcher_webapi ghcr.io/tomerfi/switcher_webapi:early-access
Note: ghcr.io requires GitHub login.
A Python WebApp running inside a container,
the documentation 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.
Note: Docker Hub requires login.
With Python >= 3.10 use pip to install tox:
pip install tox
tox
will execute linting jobs and run python's test casestox -e docs
will test and build the documentation sitemake
will usedocker buildx
to build the multi-platform image
Activate the development virtual environment (after running tox
):
source .tox/dev/bin/activate
Deactivate with:
deactivate
For dependency updates, update the virtual environment:
tox -r
Once inside the virtual environment, you can the various linters:
black --check app/
flake8 --count --statistics app/
isort --check-only app/
mypy --ignore-missing-imports app/
yamllint --format colored --strict .
And run the tests:
pytest -v --cov --cov-report term
Activate the development virtual environment (after running tox -e docs
):
source .tox/docs/bin/activate
Deactivate with:
deactivate
For dependency updates, update the virtual environment:
tox -e docs -r
Once inside the virtual environment, you can build the documentation site:
mkdocs build
Or even serve it locally while watching the sources and reloading for modifications:
mkdocs serve
For CI purposes, we use an extra linter outside the scope of Python.
We use use npm, for linting lint the Dockerfile:
make dockerfile-lint