Skip to content

Telegram bot which notifies users when there are new items with green labels available

Notifications You must be signed in to change notification settings

a1d4r/vkusvill-green-labels-notifier

Repository files navigation

Vkusvill Green Labels Notifiers

Telegram bot which notifies a user when there are new items with green labels available.

Table of content

Installation

  1. Create env file:
cp envs/.env.example envs/.env
  1. If you use pyenv, create and activate environment. You can read this article to get familiar with pyenv. Or you can just omit this step, and poetry will install venv for you.
pyenv install 3.12
pyenv virtualenv 3.12 vkusvill-green-labels
pyenv local vkusvill-green-labels
  1. If you don't have Poetry installed run:
make poetry-download
  1. Initialize poetry and install pre-commit hooks:
make install
make pre-commit-install
  1. Run formatters, linters, and tests. Make sure there is no errors.
make format lint test
  1. Run supporting services
docker compose --profile infra up -d
  1. Run the application
make up

Migrations

Create migration:

alembic revision --autogenerate -m "Message"

Review the generated migration file and corresponding SQL:

alembic upgrade prev_revision_id:revision_id --sql

You can find prev_revision_id and revision_id in the migration file

Revision ID: %revision_id%
Revises: %prev_revision_id%

Apply migrations:

alembic upgrade head

Revert last migration:

alembic downgrade -1

Makefile usage

Makefile contains a lot of functions for faster development.

1. Download and remove Poetry

To download and install Poetry run:

make poetry-download

To uninstall

make poetry-remove

2. Install all dependencies and pre-commit hooks

Install requirements:

make install

Pre-commit hooks could be installed after git init via

make pre-commit-install

3. Codestyle

Automatic formatting uses ruff.

make codestyle

# or use synonym
make format

Codestyle checks only, without rewriting files:

make check-codestyle

Update all dev libraries to the latest version using one command

make update-dev-deps

4. Code security

This command identifies security issues with Safety:

make check-safety

To validate pyproject.toml use

make check-poetry

5. Linting and type checks

Run static linting with ruff and mypy:

make static-lint

6. Tests with coverage

Run tests:

make test

7. All linters

Of course there is a command to rule run all linters in one:

make lint

8. Docker

make docker-build

which is equivalent to:

make docker-build VERSION=latest

Remove docker image with

make docker-remove

More information about docker.

9. Cleanup

Delete pycache files

make pycache-remove

Remove package build

make build-remove

Delete .DS_STORE files

make dsstore-remove

Remove .mypycache

make mypycache-remove

Or to remove all above run:

make cleanup

Credits

Special thanks to coolitydev for the help in developing this project.

This project was generated with python-package-template

About

Telegram bot which notifies users when there are new items with green labels available

Resources

Stars

Watchers

Forks