Buildtime updates

This commit is contained in:
oitsjustjose 2024-12-11 09:23:03 -06:00
commit 1a2017975d
4 changed files with 15 additions and 22 deletions

1
BUILDING.md Normal file
View file

@ -0,0 +1 @@
sudo docker buildx build --platform linux/amd64,linux/arm64 -t oitsjustjose/tidbyt .

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM python:3.10-slim-bookworm
RUN apt-get update && apt-get upgrade -y
# RUN apt-get install libc6
COPY . .
RUN pip install -r requirements.txt
CMD ["fastapi", "run", "src/server/main.py"]

View file

@ -2,12 +2,10 @@ annotated-types==0.7.0
anyio==4.7.0
async-generator==1.10
attrs==22.1.0
beautifulsoup4==4.11.1
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.7
comtypes==1.1.14
dnspython==2.7.0
email_validator==2.2.0
exceptiongroup==1.2.2
@ -15,7 +13,6 @@ fastapi==0.115.6
fastapi-cli==0.0.6
h11==0.14.0
httpcore==1.0.7
httptools==0.6.4
httpx==0.28.1
idna==3.4
Jinja2==3.1.4
@ -23,34 +20,24 @@ markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
outcome==1.2.0
Pillow==9.3.0
pycparser==2.21
pydantic==2.10.3
pydantic_core==2.27.1
Pygments==2.18.0
PySocks==1.7.1
python-dateutil==2.8.2
python-dotenv==1.0.1
python-multipart==0.0.19
PyYAML==6.0.2
requests==2.28.1
rich==13.9.4
rich-toolkit==0.12.0
selenium==4.6.0
shellingham==1.5.4
six==1.16.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.3.2.post1
starlette==0.41.3
trio==0.22.0
trio-websocket==0.9.2
typer==0.15.1
typing_extensions==4.12.2
urllib3==1.26.12
uuid==1.30
uvicorn==0.32.1
uvloop==0.21.0
watchfiles==1.0.3
websockets==14.1
wsproto==1.2.0

View file

@ -1,6 +1,7 @@
"""A Python Wrapper for Pixlet ops"""
import subprocess
from os import getenv
from pathlib import Path
from platform import machine
@ -9,8 +10,9 @@ from renderables import Renderable
class PixletHelper:
def __init__(self):
self.root_path = Path("./").resolve()
self.pixlet = self.root_path.joinpath(f"pixlet.{machine()}").resolve()
self.root_path: Path = Path("./").resolve()
self.pixlet: Path = self.root_path.joinpath(f"pixlet.{machine()}").resolve()
self.device_id: str = getenv("TIDBYT_DEVICE_ID", "")
def push_to_tidbyt(self, renderable: Renderable) -> None:
"""Pushes a renderable to the Tidbyt device
@ -42,19 +44,13 @@ class PixletHelper:
Args:
path (Path): The path to the given rendered webp
"""
with open(
self.root_path.joinpath("device_id").resolve(), "r", encoding="utf8"
) as handle:
dev_id = handle.read()
with subprocess.Popen(
[
self.pixlet,
"push",
"--installation-id",
"automation",
dev_id,
self.device_id,
str(path),
]
) as proc: