Skip to content

ialvata/Python-API-Development

Repository files navigation

Python-API-Development (YouTube video)

alt text

Overview

Open Source BSD 3-clause
Tech Stack Python FastAPI Grafana Prometheus Postgres Docker Postman

This is my interpretation of the Python API Development 20h course from Sanjeev Thiyagarajan on Youtube. :)

This project consists in a web app backend of a social message board type. We can create users, with their respective authentication credentials (OAuth 2.0), each user can post messages, and do the usual CRUD type of requests (subject to authentication) regarding the posts. They also have the possibility of voting on posts.

Integrations

Linear

This project is (now) being planned and tracked, using Linear.app. See an example of this integration here.

Pre-Commit Hooks

  • Black:Python code formatter. Character line length optimised for my screen.
  • Flake8: Analyses your code without actually running it. It checks for errors, enforces a coding standard, looks for code smells, and can make suggestions about how the code could be refactored. Initially, this repo used pylint, but when using an ORM like SQLAlchemy, pylint is too slow.
  • isort: Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.

Pytest

One thing that could be improved was leaving the pytest tests until the end... In my opinion, Sanjeev should have introduced the tests much earlier, and as he created the new methods, or operations, he could have explained a bit how to create useful tests.

TODO:

  • Add coverage report.

Grafana

Allows us to query, visualize, alert on and understand our metrics from different data sources, all through creating our own dashboards. PostgreSQL, and Prometheus as grafana's datasources have been added.

The dashboard from PostgreSQL was created in an automated way. Screenshot from 2023-06-12 20-02-59

The dashboard from Prometheus metrics, in the picture below, was imported manually. image

TODO:

  • Put a Grafana Loki integration up and running.
  • Improve Prometheus dashboards.

Prometheus

Prometheus collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels.

TODO:

  • Add a PostgreSQL exporter to Prometheus docker image.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published