Skip to content

Latest commit

 

History

History
126 lines (84 loc) · 2.87 KB

CONTRIBUTING.md

File metadata and controls

126 lines (84 loc) · 2.87 KB

Contributing to switcher_webapi

👏 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

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.

Project walkthrough

A Python WebApp running inside a container,
the documentation site is built with MkDocs.

The released image is deployed to Docker Hub.

Note: Docker Hub requires login.

Prepare the environment

With Python >= 3.10 use pip to install tox:

pip install tox

Build commands

  • tox will execute linting jobs and run python's test cases
  • tox -e docs will test and build the documentation site
  • make will use docker buildx to build the multi-platform image

Code development

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

Docs development

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

Extra linters

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