Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.83 KB

README.md

File metadata and controls

60 lines (39 loc) · 1.83 KB

python-open-restaurant-fastapi

Demo API using fastapi with one route that takes a datetime string and returns open restaurants, if any

Table of Contents

Pre-requisites

.env File

Create a .env file in the root directory of your project based off of the .env.sample file.

Docker

Install Docker and run the following command to startup the database/api in Docker:

docker compose up --build --pull postgresql --remove-orphans -V --wait

Alembic Database Migrations

Once the database is up, we need to perform the database migration. To do this, run the following command:

poetry run alembic upgrade head

Linting

To lint the project, run the following commands:

poetry run flake8 app tests
poetry run pylint app tests

Testing

To run the tests, be sure you have ran the Docker Compose Command and the Alembic Database Migrations, then run the following command:

poetry run pytest --cov --cov-report=html -n auto

This will run the tests using xdist on multiple threads and generate a coverage report in the htmlcov directory.

CSV Row Totals

I imported the provided CSV into Google Sheets to easily calculate the number of rows the csv import should make. You can view that via this link: https://docs.google.com/spreadsheets/d/1t4kAuOgT4Oqoldq02rXDrrO2Mwgy80UkcfTBPhnlpK4/edit?usp=sharing