Backend For Frontend application for Wish List Sharing Service.
To develop this project you need to have the following software installed.
- Poetry 1.4.2
- Python (see version in
pyproject.toml
file)
Before start to setup project you have to meet System requirements.
Go to the project root directory.
- 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
- Upgrade pip within virtual environment:
pip install --upgrade pip
To run application you need to do all steps from First time setup section.
- Run app:
# Create .env file
source envs/local/dev/env.sh
# Run development server.
WLSS_ENV=local/dev uvicorn src.app:app --reload
- 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.
- 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.
- Fetch the last version of the
deployed/qa
tag:
git fetch origin +refs/tags/deployed/qa:refs/tags/deployed/qa
-
Checkout to branch/commit you want to deploy.
-
Create and push new version of the
deployed/qa
tag:
git tag --annotate --force deployed/qa --message ''
git push origin deployed/qa --force