Skip to content

week-password/wlss-bff

Repository files navigation

WLSS BFF

Backend For Frontend application for Wish List Sharing Service.

Table of Contents

System requirements

First time setup

Run app

Run linters

Run tests

Deploy


To develop this project you need to have the following software installed.

Before start to setup project you have to meet System requirements.

Go to the project root directory.

  1. Set up local environment:
# Set up git user for this repository
# change values below to your name and email
git config user.name "John Doe"
git config user.email "john.doe@mail.com"

# Create virtual environment and install dependencies.
poetry install --with app,lint,test

# Activate virtual environment.
poetry shell
  1. Upgrade pip within virtual environment:
pip install --upgrade pip

To run application you need to do all steps from First time setup section.

  1. Run app:
# Create .env file
source envs/local/dev/env.sh

# Run development server.
WLSS_ENV=local/dev uvicorn src.app:app --reload
  1. Check application health status:
curl --request GET http://localhost:8000/health

To run linters you need to do all steps from First time setup section.

Linters order below is a preferred way to run and fix them one by one.

Run any linter you need or all of them at once:

# Run mypy.
mypy

# Run ruff.
ruff check src tests

# Run flake8.
flake8

To run tests you need to do all steps from First time setup section.

  1. Run services and tests:
# Create .env file
source envs/local/test/env.sh

# Run services.
docker compose --file=envs/local/test/docker-compose.yml up --detach

# Run pytest.
WLSS_ENV=local/test pytest --cov=src

Also you can choose one of the following ways of running tests:

  • Tests with html coverage report:
WLSS_ENV=local/test pytest --cov=src ; coverage html
  • Tests with execution contexts in report:
WLSS_ENV=local/test pytest --cov=src --cov-context=test ; coverage html --show-contexts --no-skip-covered

Only users with write access are able to deploy.

  1. Fetch the last version of the deployed/qa tag:
git fetch origin +refs/tags/deployed/qa:refs/tags/deployed/qa
  1. Checkout to branch/commit you want to deploy.

  2. Create and push new version of the deployed/qa tag:

git tag --annotate --force deployed/qa --message ''
git push origin deployed/qa --force