Skip to content

Commit

Permalink
Merge pull request #52 from 9dogs/maintenance
Browse files Browse the repository at this point in the history
Maintenance and kz for Yandex
  • Loading branch information
9dogs authored Nov 20, 2024
2 parents e953e13 + b98eecf commit aeb7cea
Show file tree
Hide file tree
Showing 12 changed files with 1,063 additions and 917 deletions.
10 changes: 0 additions & 10 deletions .deepsource.toml

This file was deleted.

11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.11.7-bookworm AS builder
FROM python:3.11.10-bookworm AS builder

LABEL maintainer="[email protected]"
LABEL description="Telegram Bot to share music with Odesli (former Songlink) service."

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

ARG poetry_args='--without dev'

Expand All @@ -19,10 +19,10 @@ WORKDIR /opt/tg-odesli-bot
RUN poetry install --no-interaction --no-ansi $poetry_args
# Copy project files
COPY . /opt/tg-odesli-bot
ENV PYTHONPATH "${PYTHONPATH}:/opt/tg-odesli-bot"
ENV PYTHONPATH="/opt/tg-odesli-bot"


FROM python:3.11.7-slim-bookworm
FROM python:3.11.10-slim-bookworm

ARG UID=997
ARG GID=997
Expand All @@ -34,6 +34,5 @@ USER bot
# Copy project files
COPY --from=builder --chown=bot:bot /opt/tg-odesli-bot /opt/tg-odesli-bot
WORKDIR /opt/tg-odesli-bot
ENV PYTHONPATH "${PYTHONPATH}:/opt/tg-odesli-bot"

CMD ["/opt/tg-odesli-bot/.venv/bin/python", "-m", "tg_odesli_bot.bot"]
1,916 changes: 1,037 additions & 879 deletions poetry.lock

Large diffs are not rendered by default.

35 changes: 13 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ python = ">=3.10,<3.13"
aiocache = "^0.12.0"
aiogram = "<3"
python-dotenv = "^1.0.0"
sentry-sdk = "^1"
sentry-sdk = "^2"
structlog = "^24.0.0"
structlog-sentry = "^2.0.0"
aiohttp = "^3.8.0"
aiohttp = "^3"
ujson = "^5.4.0"
spotipy = "^2.22.1"
pydantic-core = "^2.0"
Expand All @@ -30,8 +30,8 @@ aioresponses = "^0.7.0"
ruff = ">0.1"
coverage = "^7.0"
mypy = "^1.0"
pytest = "^7.0"
pytest-cov = "^4.0.0"
pytest = "^8"
pytest-cov = "^6"
pytest-aiohttp = "^1.0"
pytest-timeout = "^2.0.0"
asynctest = "^0.13.0"
Expand All @@ -42,6 +42,7 @@ tg-odesli-bot = "tg_odesli_bot.bot:main"

[tool.pytest.ini_options]
junit_family = "xunit2"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
testpaths = ["tests"]

Expand All @@ -59,17 +60,11 @@ plugins = "pydantic.mypy"
[tool.coverage.run]
branch = true

[tool.pydocstyle]
# D202: No blank lines allowed after function docstring
# D203: 1 blank line required before class docstring
# D205: 1 blank line required between summary line and description
# D213: Multi-line docstring summary should start at the second line
# D400: First line should end with a period
# D415: First line should end with a period, question mark, or exclamation point
ignore = ["D202", "D203", "D205", "D213", "D400", "D415"]
match = ".*\\.py"

[tool.ruff]
line-length = 79
target-version = "py311"

[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # pycodestyle
Expand All @@ -91,8 +86,6 @@ select = [
"PL", # Pylint
]
dummy-variable-rgx = "^__$"
line-length = 79
target-version = "py310"
ignore = [
# Missing type annotation for self in a class method
"ANN101",
Expand All @@ -117,20 +110,18 @@ ignore = [
# Too many statements
"PLR0915",
]
src = ["src", "tests"]
output-format = "grouped"

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"
docstring-quotes = "double"

[tool.ruff.flake8-annotations]
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true

[tool.ruff.flake8-unused-arguments]
[tool.ruff.lint.flake8-unused-arguments]
ignore-variadic-names = true

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["tg_odesli_bot", "tests"]

[tool.ruff.format]
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers and fixtures for pytest."""

import json
import re
import string
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_bot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Integration tests for Odesli bot."""

import asyncio
import re
from http import HTTPStatus
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_bot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for Odesli bot."""

from pytest import mark

from tg_odesli_bot.bot import OdesliBot, SongInfo
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for configuration."""

from tg_odesli_bot.settings import TestSettings


Expand Down
1 change: 1 addition & 0 deletions tg_odesli_bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Telegram Odesli bot."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions tg_odesli_bot/platforms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Supported platforms."""

import re
from abc import ABC
from re import Pattern
Expand Down
1 change: 1 addition & 0 deletions tg_odesli_bot/schemas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Odesli API schemas."""

from pydantic import BaseModel, Field


Expand Down
1 change: 1 addition & 0 deletions tg_odesli_bot/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Bot configuration."""

from __future__ import annotations

import logging.config
Expand Down

0 comments on commit aeb7cea

Please sign in to comment.