From a10256783bd331d1176de70e47c7feb93f357c08 Mon Sep 17 00:00:00 2001 From: Konstantin Weddige Date: Wed, 18 Oct 2023 20:24:11 +0200 Subject: [PATCH 1/2] Fix package structure --- hype/{_init_.py => __init__.py} | 0 hype/config.py | 3 ++- hype/hype.py | 8 +++++--- hype/main.py | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) rename hype/{_init_.py => __init__.py} (100%) diff --git a/hype/_init_.py b/hype/__init__.py similarity index 100% rename from hype/_init_.py rename to hype/__init__.py diff --git a/hype/config.py b/hype/config.py index 925a0cc..95777d3 100644 --- a/hype/config.py +++ b/hype/config.py @@ -1,6 +1,7 @@ +import logging from typing import List + import yaml -import logging class BotAccount: diff --git a/hype/hype.py b/hype/hype.py index 16f3977..0e13f45 100644 --- a/hype/hype.py +++ b/hype/hype.py @@ -1,9 +1,11 @@ +import logging +import os.path import time + import schedule -import logging from mastodon import Mastodon -from config import Config -import os.path + +from .config import Config class Hype: diff --git a/hype/main.py b/hype/main.py index 6b81c65..528e4c5 100644 --- a/hype/main.py +++ b/hype/main.py @@ -1,7 +1,7 @@ -from hype import Hype -from config import Config +from .config import Config +from .hype import Hype bot = Hype(Config()) bot.login() bot.update_profile() -bot.start() \ No newline at end of file +bot.start() From 550277a74ad43a5981f9a7ebc1effd3fbf2c3f08 Mon Sep 17 00:00:00 2001 From: Konstantin Weddige Date: Wed, 18 Oct 2023 20:40:17 +0200 Subject: [PATCH 2/2] Run app as module --- Dockerfile | 4 ++-- hype/{main.py => __main__.py} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename hype/{main.py => __main__.py} (100%) diff --git a/Dockerfile b/Dockerfile index 59d4f22..bdddd21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3-alpine WORKDIR /app COPY requirements.txt /app/requirements.txt -COPY ./hype /app +COPY ./hype /app/hype RUN pip install -r requirements.txt @@ -14,4 +14,4 @@ RUN mkdir -p /app/secrets/ COPY ./config/* /app/config/ -ENTRYPOINT ["python", "/app/main.py"] \ No newline at end of file +ENTRYPOINT ["python", "-m", "hype"] diff --git a/hype/main.py b/hype/__main__.py similarity index 100% rename from hype/main.py rename to hype/__main__.py