Skip to content

taleldayekh/talel.io-backend

Repository files navigation

CI CD codecov

Table of Contents

Setup

Clone Repository

git clone git@github.com:taleldayekh/talel.io-backend.git

Setup Python

pyenv

pyenv (Python Version Management) can be used for easily managing Python versions globally on the system and locally for a project.

Install pyenv with:

brew install pyenv

Set the project specific Python version defined in the Pipfile by navigating to the project root and running:

pyenv local <version>

Pipenv

talel.io-backend uses Pipenv for managing the projects virtual environment and dependencies.

Install Pipenv with:

brew install pipenv

Activate the virtual environment for talel.io-backend by navigating to the project root and running:

pipenv shell

Install Dependencies

⚠️ Dependency installation will fail if PostgreSQL is not installed on the system.

Install PostgreSQL:

brew install postgresql@<version>

Install dependencies and dev dependencies by navigating to the project root and running:

pipenv install --dev

Running the API Locally

Start Development Database

The development database runs in a Docker container and requires Docker Desktop installed and running.

Install Docker Desktop:

brew install --cask docker

Start development database container:

make start-dev-dbs

This will start a PostgreSQL database configured for development and run the most recent migrations.

Stop Development Database

Stop development database container:

make stop-dev-dbs

Serve API

Before serving the API ensure there is a .env present in the project root containing the same values as in .env.example.

Serve backend API:

make serve-api

This will run the development server on port 5000.

Codebase

Code Style

To maintain consistency across the codebase, coding standards that conforms to the PEP 8 style guide are enforced with:

  • YAPF for formatting the code.
  • isort for sorting imports.

To help detect coding errors the following static code analysis tools are used:

  • mypy for providing type hints.
  • Pylint for checking coding errors.

Formatters

Run formatters:

make fix

Code Analysis

Run code analysis:

make type-check
make lint

REST API

Full API reference documentation is available on the Wiki page.