Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 1.6 KB

README.md

File metadata and controls

90 lines (60 loc) · 1.6 KB

Starter template for a clean architecture python project

Code style: black

Installation

Features

Development

Setup

# AT THE ROOT OF THE PROJECT

# OPTIONAL: create a virtual environment and activate it
python3 -m venv .venv
source .venv/bin/activate

# Install poetry
pip install poetry

# Install dependencies
poetry install

# Setup pre-commit
pre-commit install
pre-commit run --all-files

# Create a .env file
cp .env.example .env

# Set up environment variables for pytest in pyproject.toml as needed

Autogenerate Alembic Migrations

Using docker containers to spin up an SQL database, you can autogenerate migrations with Alembic:

cd tests
docker compose up -d
cd ../
alembic upgrade head
alembic revision --autogenerate -m "migration message"
alembic upgrade head
alembic downgrade base
alembic upgrade head
cd tests
docker compose down

Make sure to fix any errors given by the alembic commands above before executing the next one and commiting the changes.

Accessing the database

You can access <DB explorer> at http://localhost:<PORT> to check the database. The credentials are:

System:
Server:
Username:
Password:
Database:

Pull Requests

Before submitting a pull request, please:

  1. Run pytest, at the root of the project, and fix all the errors:
poetry run pytest -s
  1. Run mypy, at the root of the project, and fix all type errors:
poetry run mypy .
  1. Run black, at the root of the project
poetry run black .