-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
102c929
commit f6ed316
Showing
16 changed files
with
854 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
uv sync --all-extras --inexact | ||
. .venv/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,4 +148,3 @@ dmypy.json | |
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
# inspired by https://medium.com/@harpalsahota/dockerizing-python-poetry-applications-1aa3acb76287 | ||
FROM python:3.9 | ||
FROM python:3.12 | ||
|
||
RUN mkdir /app /data | ||
# renovate: datasource=github-releases depName=uv packageName=astral-sh/uv | ||
ENV UV_VERSION="0.5.3" | ||
RUN pip install uv==$UV_VERSION | ||
|
||
# Change the working directory to the `app` directory | ||
WORKDIR /app | ||
|
||
ENV PYTHONPATH=${PYTHONPATH}:${PWD} | ||
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 | ||
RUN pip install cryptography==3.3.2 | ||
# Copy the lockfile and `pyproject.toml` into the image | ||
ADD uv.lock /app/uv.lock | ||
ADD pyproject.toml /app/pyproject.toml | ||
|
||
# Install dependencies | ||
RUN uv sync --frozen --no-install-project --no-dev | ||
|
||
# Copy the project into the image | ||
ADD . /app | ||
|
||
# Sync the project | ||
RUN uv sync --frozen --no-dev | ||
|
||
# copy requirements first to create better cache layers | ||
COPY requirements.txt /app/ | ||
RUN pip install -r requirements.txt | ||
# Place executables in the environment at the front of the path | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
COPY . /app/ | ||
RUN python setup.py install | ||
# Poor mans test if at least the imports work | ||
RUN python toogoodtogo_ha_mqtt_bridge/main.py --version | ||
|
||
# Run | ||
ENV DYNACONF_DATA_DIR=/data | ||
CMD ["python", "toogoodtogo_ha_mqtt_bridge/main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dependencies: uv prettier pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,126 @@ | ||
[tool.black] | ||
line-length = 110 | ||
[project] | ||
name = "toogoodtogo-ha-mqtt-bridge" | ||
version = "0.0.1" | ||
description = "This is a template repository for Python projects that use uv for their dependency management." | ||
authors = [{ name = "Max Winterstein", email = "[email protected]" }] | ||
readme = "README.md" | ||
keywords = ['python'] | ||
requires-python = "==3.12.*" | ||
classifiers = [ | ||
"Intended Audience :: Developers", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
dependencies = [ | ||
"paho-mqtt", | ||
"dynaconf", | ||
"tgtg", | ||
"coloredlogs", | ||
"tenacity", | ||
"arrow", | ||
"croniter", | ||
"google-play-scraper", | ||
"random_user_agent", | ||
"packaging", | ||
"freezegun", | ||
"schedule", | ||
"setuptools", | ||
] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
[project.urls] | ||
Homepage = "https://MaxWinterstein.github.io/toogoodtogo-ha-mqtt-bridge/" | ||
Repository = "https://github.com/MaxWinterstein/toogoodtogo-ha-mqtt-bridge" | ||
Documentation = "https://MaxWinterstein.github.io/toogoodtogo-ha-mqtt-bridge/" | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"pytest>=7.2.0", | ||
"pre-commit>=2.20.0", | ||
"deptry>=0.20.0", | ||
"mypy>=0.991", | ||
|
||
"ruff>=0.6.9", | ||
|
||
] | ||
|
||
[build-system] | ||
requires = ["setuptools >= 61.0"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
py-modules = ["toogoodtogo_ha_mqtt_bridge"] | ||
|
||
[tool.mypy] | ||
files = ["toogoodtogo_ha_mqtt_bridge"] | ||
disallow_untyped_defs = true | ||
disallow_any_unimported = true | ||
no_implicit_optional = true | ||
check_untyped_defs = true | ||
warn_return_any = true | ||
warn_unused_ignores = true | ||
show_error_codes = true | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
|
||
[tool.ruff] | ||
target-version = "py39" | ||
line-length = 120 | ||
fix = true | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
# flake8-2020 | ||
"YTT", | ||
# flake8-bandit | ||
"S", | ||
# flake8-bugbear | ||
"B", | ||
# flake8-builtins | ||
"A", | ||
# flake8-comprehensions | ||
"C4", | ||
# flake8-debugger | ||
"T10", | ||
# flake8-simplify | ||
"SIM", | ||
# isort | ||
"I", | ||
# mccabe | ||
"C90", | ||
# pycodestyle | ||
"E", "W", | ||
# pyflakes | ||
"F", | ||
# pygrep-hooks | ||
"PGH", | ||
# pyupgrade | ||
"UP", | ||
# ruff | ||
"RUF", | ||
# tryceratops | ||
"TRY", | ||
] | ||
ignore = [ | ||
# LineTooLong | ||
"E501", | ||
# DoNotAssignLambda | ||
"E731", | ||
# i like my unnecessary True if ... else False | ||
"SIM210", | ||
] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"tests/*" = ["S101"] | ||
|
||
[tool.ruff.format] | ||
preview = true | ||
|
||
[tool.deptry.per_rule_ignores] | ||
DEP004 = ["pytest"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.