Skip to content

mrlonis/python-open-restaurant-fastapi

Repository files navigation

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

About

Demo API, written in Python FastAPI, with one route that takes a datetime string and returns a list of open restaurants, if any.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published