Skip to content

Latest commit

 

History

History
162 lines (115 loc) · 3.37 KB

CONTRIBUTING.md

File metadata and controls

162 lines (115 loc) · 3.37 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

Early-access image deployed to GitHub container registry:

docker run -d -p 8000:8000 --name switcher_webapi ghcr.io/tomerfi/switcher_webapi:early-access

Project

Docker multi-platform image running a Python web app. The doc site is built with Mkdocs.

The released image is deployed to Docker hub.

Develop

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

Environment

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

Code

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

Docs

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

Docker

Requires make and npm.

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