Skip to content

Commit

Permalink
Update stream announcer to use uv instead of poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnySc2 committed Nov 16, 2024
1 parent c23069d commit d9d66f8
Show file tree
Hide file tree
Showing 7 changed files with 1,293 additions and 1,516 deletions.
14 changes: 5 additions & 9 deletions twitch_stream_announcer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
FROM python:3.12-alpine
FROM ghcr.io/astral-sh/uv:python3.12-alpine

RUN pip install --no-cache-dir poetry==1.8 \
&& yes | poetry cache clear PyPI --all
COPY uv.lock pyproject.toml /root/stream_announcer/

WORKDIR /root/stream_announcer

COPY poetry.lock pyproject.toml ./

RUN poetry install --without dev
RUN uv sync --no-dev --frozen --no-cache --no-install-project

COPY src /root/stream_announcer/src

ENV PYTHONPATH=$PYTHONPATH:/root/stream_announcer
ENV PYTHONPATH=$PYTHONPATH:/root/stream_announcer/src

CMD ["poetry", "run", "python", "src/stream_announcer.py"]
CMD ["uv", "run", "--no-dev", "python", "src/stream_announcer.py"]
3 changes: 2 additions & 1 deletion twitch_stream_announcer/deploy_playbook.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Execute with
# ansible-playbook deploy_playbook.yml -i ../ansible/hosts -i /home/burny/syncthing/secrets/ansible_secrets/.ansible_secrets
- name: Create service
hosts: server_group3
hosts: server_group4
vars:
USERNAME: twitch_stream_announcer
tasks:
Expand Down Expand Up @@ -45,6 +45,7 @@
- "--exclude=.pyre"
- "--exclude=.pytest_cache"
- "--exclude=.ruff_cache"
- "--exclude=.venv"
- "--exclude=.vscode"

- name: Build the Docker image
Expand Down
2 changes: 1 addition & 1 deletion twitch_stream_announcer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
stream_announcer:
image: burnysc2/twitch_stream_announcer:latest
command: poetry run python src/stream_announcer.py
command: uv run --no-dev src/stream_announcer.py
pull_policy: never
deploy:
replicas: 1
Expand Down
1,465 changes: 0 additions & 1,465 deletions twitch_stream_announcer/poetry.lock

This file was deleted.

65 changes: 26 additions & 39 deletions twitch_stream_announcer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
[tool.poetry]
name = "twitch-stream-announcer-webhook"
[project]
name = "src"
version = "0.1.0"
description = ""
authors = ["BuRny <[email protected]>"]
#package-mode = false

[tool.poetry.dependencies]
python = ">=3.9 <3.13"
aiohttp = "^3.7.4"
loguru = "^0.7"
discord = "^1.0.1"
python-dotenv = "^1.0.0"
arrow = "^1.3.0"
twitchapi = "^4.1.0"
dataset = "^1.6.2"
psycopg2-binary = "^2.9.9"

[tool.poetry.group.dev.dependencies]
# Autoformat
yapf = "^0.32.0"
toml = "^0.10.2"
# Linter
ruff = "^0.1.14"
# Type checker
pyre-check = "^0.9.18"
requires-python = ">=3.9, <3.14"
dependencies = [
"aiohttp>=3.11.2",
"arrow>=1.3.0",
"dataset>=1.6.2",
"discord>=2.3.2",
"loguru>=0.7.2",
"psycopg2-binary>=2.9.10",
"python-dotenv>=1.0.1",
"twitchapi>=4.3.1",
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.uv]
dev-dependencies = ["pyre-check>=0.9.23", "ruff>=0.7.4", "toml>=0.10.2"]

[tool.yapf]
based_on_style = "pep8"
Expand All @@ -42,20 +29,20 @@ line-length = 120
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
select = [
"C4", # flake8-comprehensions
"E", # Error
"F", # pyflakes
"BLE", # flake8-blind-except
"I", # isort
"N", # pep8-naming
"PGH", # pygrep-hooks
"C4", # flake8-comprehensions
"E", # Error
"F", # pyflakes
"BLE", # flake8-blind-except
"I", # isort
"N", # pep8-naming
"PGH", # pygrep-hooks
"PTH", # flake8-use-pathlib
"SIM", # flake8-simplify
"W", # Warning
"Q", # flake8-quotes
"SIM", # flake8-simplify
"W", # Warning
"Q", # flake8-quotes
"YTT", # flake8-2020
"UP", # pyupgrade
# "A", # flake8-builtins
# "A", # flake8-builtins
]

[tool.ruff.pep8-naming]
Expand Down
2 changes: 1 addition & 1 deletion twitch_stream_announcer/src/stream_announcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from loguru import logger
from twitchAPI.twitch import Stream, Twitch

from src.model import get_streams_to_announce, set_stream_online, set_streams_offline
from model import get_streams_to_announce, set_stream_online, set_streams_offline

load_dotenv()

Expand Down
Loading

0 comments on commit d9d66f8

Please sign in to comment.