ReznikovRoman / netflix-voice-assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Netflix Voice Assistant

Service for working with Netflix voice assistants.

Stack

FastAPI, Yandex.Dialogs (voice assistant provider)

Services

Configuration

Docker containers:

  1. server
  2. traefik

docker-compose files:

  1. docker-compose.yml - for local development.
  2. docker-compose-dev.yml - for local development (without traefik).
  3. tests/functional/docker-compose.yml - for functional tests.

To run docker containers, you need to create a .env file in the root directory.

.env example:

ENV=.env

# Python
PYTHONUNBUFFERED=1

# Netflix Voice Assistant
# Project
NVA_DEBUG=1
NVA_PROJECT_BASE_URL=http://api-voice-assistant.localhost:8012
NVA_SERVER_PORT=8005
NVA_PROJECT_NAME=netflix-voice-assistant
NVA_API_V1_STR=/api/v1
NVA_SERVER_NAME=localhost
NVA_SERVER_HOSTS=http://api-voice-assistant.localhost:8012
# Netflix Movies
NVA_NETFLIX_MOVIES_BASE_URL=http://traefik:80
# Config
NVA_USE_STUBS=0
NVA_TESTING=0
NVA_CI=0

Start project:

Locally:

docker-compose build
docker-compose up

Development

Sync environment with requirements.txt / requirements.dev.txt (will install/update missing packages, remove redundant ones):

make sync-requirements

Compile requirements.*.txt files (have to re-compile after changes in requirements.*.in):

make compile-requirements

Use requirements.local.in for local dependencies; always specify constraints files (-c ...)

Example:

# requirements.local.txt

-c requirements.txt

ipython

Tests

Run unit tests (export environment variables from .env file):

export $(echo $(cat .env | sed 's/#.*//g'| xargs) | envsubst) && make test

To run functional tests, you need to create .env in ./tests/functional directory

.env example:

ENV=.env

# Python
PYTHONUNBUFFERED=1

# Netflix Voice Assistant
# Project
NVA_DEBUG=1
NVA_PROJECT_BASE_URL=http://api-voice-assistant.localhost:8012
NVA_SERVER_PORT=8005
NVA_PROJECT_NAME=netflix-voice-assistant
NVA_API_V1_STR=/api/v1
NVA_SERVER_NAME=localhost
NVA_SERVER_HOSTS=http://api-voice-assistant.localhost:8012
# Netflix Movies
NVA_NETFLIX_MOVIES_BASE_URL=http://traefik:80
# Config
NN_USE_STUBS=1
NN_TESTING=1
NN_CI=0

Run functional tests:

cd ./tests/functional && docker-compose up test

Makefile recipe:

make dtf

Code style:

Before pushing a commit run all linters:

make lint

pre-commit:

pre-commit installation:

pre-commit install

Documentation

OpenAPI 3 documentation:

  • ${PROJECT_BASE_URL}/api/v1/docs - Swagger

About


Languages

Language:Python 90.7%Language:Dockerfile 5.8%Language:Makefile 2.9%Language:Shell 0.6%