Flyone client to get the cheapest flights
python3.13 or higher is required
uv tool install -e .
flytwo flights --origin RMO --destination EVN --currency EUR --travel_date 2024-12-01
uv sync --dev
BOT_TOKEN=<your bot token (obtained from @BotFather)>
DB_HOST=localhost
DB_NAME=flytwo
DB_PORT=5432
DB_USER=flytwo
DB_PASS=<your password goes here>
In this configuration redis cache will not work as well as /go command. But should be fine for most of the tasks.
.
├── Makefile <main commands to build project, set hooks, create db migrations>
├── migrations <alembic migrations, represent changes in database>
├── src
│ ├── api <api that holds a webhook for telegram bot (polling is not production ready solution) and notify endpoint for background task that detects price changes and sends notifications to users via tg bot>
│ ├── bot <tg bot with all available commands>
│ ├── cli <standalone cli app>
│ ├── plugins <for each airline integration that bot tracks>
│ │ ├── <airline integration name>
│ │ ├── │ ├── __init__.py <for public interface of the plugin>
│ │ ├── │ ├── airline.py <class that gets exposed as integration>
│ │ ├── │ ├── client.py <provides connection details to the airline to gather the data>
│ │ ├── │ ├── parser.py <integration specific parser to parse the data from airline website url so that user can pass the flight link to the bot>
│ ├── ... <every other file relates to project backend parts and has descriptive name>
│ ├── task_<name>.py <peridict tasks that run on background and are triggered by schedule start with task_ prefix>
├── tests <autotests using pytest framework>
├── configuration files <docker, nginx, alembic, uv, etc>
Working directory ~/flytwo/src
Run bot (frontend) python -m bot.bot
Run notification task (backend) python task_notify.py
docker compose -f docker-compose.yml up -d
Nginx from the other project handles SSL and proxying — add a server block for flytwo.servebeer.com
pointing to http://api:8080 in its config, then reload it.
First time only — create the shared network and attach existing services to it:
docker network create shared
docker network connect shared <postgres-container-name>
docker network connect shared <redis-container-name>
docker network connect shared <nginx-container-name>
Set DB_HOST and REDIS_HOST in .env to the postgres and redis container names above, then:
docker compose -f compose-shared.yml up -d
The code should comply with PEP8
Every new feature or bugfix should be covered with autotests to ensure it is working properly.
Submit PR's for code review when all current tests are PASSED.
Use English language in comments and '' instead of "" in strings.
Typehints, docstrings and even doctests are welcome.
Don't write comments if they are useless.
Try to avoid code duplication.