Skip to content


This file lists the libraries used in this project with a link for the documentation, a short description, an explanation of use, and optional examples.

Back-end developments Libraries


FastAPI is a framework to create back-end server APIs, an alternative to Flask or Django. Compared to other frameworks, it's minimal, yet provides most common functionalities for creating web API. FastAPI supports HTTP requests as well as web-sockets protocols, both of which are used in PollingApp project.
Important aspect of FastAPI is multi threading support of asynchronous tasks, which allows handling many requests simultaneously as well as scheduling heavy tasks to not conjugate the app flow. For those reason, this framework is a popular choice due to great performance(on part due to uvicorn event loop) as well as extensive documentation


FastAPI is built on top of Pydantic library, which provides data validation and settings management using Python type annotations. Pydantic also enforces type hints at runtime, and provides user friendly errors when data is invalid. The pydantic models are much improved Data classes in python. The improved functionality allows seamless use in all parts of web application. The schemas that define request and response formats are based on Pydantic model, as well as database schemas for storing data and much more. Lastly, Pydantic provides a mypy plugin to further assist validation of types.


Beanie - is an asynchronous Python object-document mapper (ODM) for MongoDB. It is based on async. version of Motor library. Data models are based on Pydantic models. When using Beanie each database collection has a corresponding Document that is used to interact with that collection. In addition to retrieving data, Beanie allows us to add, update, or delete documents from the collection as well.

FastApi Users

Framework that is build on top of FastAPI to provide User functionality. We use beanie version, to store user data in mongo database. The library provides class that manages various events like authentication, some predefined routes. It automatically stores and updates information in the database. The library also provides a basic User model(email, password), which is further expanded in /models directory(added first and last names, group lists, etc). Some users can take on a role of a superuser, that grants them right to change information of other users or delete accounts. Super users can be considered the managers of the server, for instance technical support.

Predefined routing:

  • To Register
  • To Login
  • To Request a token and reset password
  • Basic CRUD routes to read, update, delete users, etc

The routes will use schemas for requests and responses, which can be found in app/schemas/

Testing Libraries

This libraries are used for testing. Please check out the Testing Wiki to learn more about the actual tests.


Pytest is a software testing framework based on the Python programming language. It can be used to write various types of software tests, including unit tests, integration tests, end-to-end tests, and functional tests. Pytest has been described as a scalable framework with less boilerplate code. Its features include parametrized testing, fixtures, assert re-writing, and test filtering

FastAPI provides built-in functionality for testing API end point using pytest and httpx library to create a test client.

Pytest coverage

This plugin produces coverage reports. Compared to just using coverage run this plugin has extras features, and works well out of the box with tox and other tools.


Flake8 is a Python linter, which ensures that the code follows pep8 styling guide, such as spaces, indentation, etc.


Mypy is an optional static type checker for Python that aims to combine the benefits of dynamic (or "duck") typing and static typing. Mypy combines the expressive power and convenience of Python with a powerful type system and compile-time type checking. Mypy type checks standard Python programs; run them using any Python VM with basically no runtime overhead. It works very well with Pydantic plugin to make sure all the right types are used for functions and models.


tox aims to automate and standardize testing in Python. It is a generic virtual environment management and test command line tool. tox allows us to create multiple virtual environments with different python versions and run multiple test, such as flake8, mypy, etc. Coupled with tox-gh-actions. It becomes a powerful tool that can help testing project on various systems automatically using GitHub Actions.


This Library is used for generating random data such as names, email, address, etc. It's useful for testing.

Distribution and packaging

This libraries are used for building and deploying the package


Setuptools provides powerful tools to handle package discovery, including support for namespace packages. It is built on top of Distutils. GitHub action will use setuptools to install all dependencies required for testing. With an addition of build the application can be easily deployed to various systems as a package, which simplifies the installation.


A simple, correct PEP 517 build frontend. By default, a source distribution is built from source and a binary distribution (wheel) is built from the distribution. This is recommended as it will ensure the distribution can be used to build wheels.

$ python -m build .

The result of this command will be a tar ball with all the code required to install and run the application.


Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.

WSGI applications are a single, synchronous callable that takes a request and returns a response. This doesn’t allow for long-lived connections, like you get with long-poll HTTP or WebSocket connections, which WSGI doesn't support well. So we use uvicorn workers controlled by gunicorn process. Combination with NGINX as a reverse-proxy, it handles all of the connection and communication between client and the API application.


Uvicorn is an ASGI web server implementation for Python. It supports HTTP/1.1 and WebSockets. However it has some limitations in terms of compatibility(The uvloop implementation provides greater performance, but is not compatible with Windows or PyPy) and for production deployment purposes. Although, the uvicorn can be used for development, it is recommended to use Gunicorn for deployment,

console x Run uvicorn --reload from the command line for local development. Run gunicorn -k uvicorn.workers.UvicornWorker for production.