mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2026-02-25 02:20:17 +00:00
⬆️ api: upgrade deps
- up python version to 3.14 - `poetry up --latest`
This commit is contained in:
parent
6c0c45643a
commit
432533fdad
6 changed files with 1504 additions and 1085 deletions
|
|
@ -1,50 +1,56 @@
|
||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/python
|
// README at: https://github.com/devcontainers/templates/tree/main/src/python
|
||||||
{
|
{
|
||||||
"name": "Advent22 API",
|
"name": "Advent22 API",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
|
||||||
"image": "mcr.microsoft.com/vscode/devcontainers/python:1-3.11-bookworm",
|
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
"image": "mcr.microsoft.com/devcontainers/python:3-3.14-trixie",
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers-extra/features/poetry:2": {},
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
"features": {
|
||||||
"packages": "git-flow, git-lfs"
|
"ghcr.io/devcontainers/features/git-lfs:1": {},
|
||||||
},
|
"ghcr.io/devcontainers-extra/features/poetry:2": {},
|
||||||
"ghcr.io/itsmechlark/features/redis-server:1": {}
|
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
|
||||||
},
|
"packages": "git-flow"
|
||||||
"containerEnv": {
|
},
|
||||||
"TZ": "Europe/Berlin"
|
"ghcr.io/itsmechlark/features/redis-server:1": {}
|
||||||
},
|
},
|
||||||
// Configure tool-specific properties.
|
|
||||||
"customizations": {
|
"containerEnv": {
|
||||||
// Configure properties specific to VS Code.
|
"TZ": "Europe/Berlin"
|
||||||
"vscode": {
|
},
|
||||||
// Set *default* container specific settings.json values on container create.
|
|
||||||
"settings": {
|
// Configure tool-specific properties.
|
||||||
"python.defaultInterpreterPath": "/usr/local/bin/python",
|
"customizations": {
|
||||||
"terminal.integrated.defaultProfile.linux": "zsh"
|
// Configure properties specific to VS Code.
|
||||||
},
|
"vscode": {
|
||||||
// Add the IDs of extensions you want installed when the container is created.
|
// Set *default* container specific settings.json values on container create.
|
||||||
"extensions": [
|
"settings": {
|
||||||
"be5invis.toml",
|
"python.defaultInterpreterPath": "/usr/local/bin/python",
|
||||||
"mhutchie.git-graph",
|
"terminal.integrated.defaultProfile.linux": "zsh"
|
||||||
"ms-python.python",
|
},
|
||||||
"ms-python.black-formatter",
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
"ms-python.flake8",
|
"extensions": [
|
||||||
"ms-python.isort",
|
"be5invis.toml",
|
||||||
"ms-python.vscode-pylance"
|
"mhutchie.git-graph",
|
||||||
]
|
"ms-python.python",
|
||||||
}
|
"ms-python.black-formatter",
|
||||||
},
|
"ms-python.flake8",
|
||||||
"postCreateCommand": "sudo /usr/local/py-utils/bin/poetry self add poetry-plugin-up",
|
"ms-python.isort",
|
||||||
// Use 'postStartCommand' to run commands after the container is started.
|
"ms-python.vscode-pylance"
|
||||||
"postStartCommand": "poetry install"
|
]
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
}
|
||||||
// "features": {},
|
},
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
||||||
// "forwardPorts": [],
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
// Use 'postCreateCommand' to run commands after the container is created.
|
"postCreateCommand": "sudo /usr/local/py-utils/bin/poetry self add poetry-plugin-up",
|
||||||
// "postCreateCommand": "pip3 install --user -r requirements.txt",
|
|
||||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
// Use 'postStartCommand' to run commands after the container is started.
|
||||||
// "remoteUser": "root"
|
"postStartCommand": "poetry install"
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||||
|
// "remoteUser": "root"
|
||||||
}
|
}
|
||||||
37
api/.vscode/settings.json
vendored
37
api/.vscode/settings.json
vendored
|
|
@ -1,20 +1,33 @@
|
||||||
{
|
{
|
||||||
"python.languageServer": "Pylance",
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"[python]": {
|
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
|
||||||
},
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.organizeImports": "explicit"
|
|
||||||
},
|
|
||||||
"git.closeDiffOnOperation": true,
|
"git.closeDiffOnOperation": true,
|
||||||
|
|
||||||
|
"[python]": {
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.organizeImports": "explicit",
|
||||||
|
"source.fixAll": "explicit",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
"python.languageServer": "Pylance",
|
||||||
|
"python.analysis.autoImportCompletions": true,
|
||||||
|
"python.analysis.importFormat": "relative",
|
||||||
|
"python.analysis.fixAll": [
|
||||||
|
"source.convertImportFormat",
|
||||||
|
"source.unusedImports",
|
||||||
|
],
|
||||||
"python.analysis.typeCheckingMode": "basic",
|
"python.analysis.typeCheckingMode": "basic",
|
||||||
"python.analysis.diagnosticMode": "workspace",
|
"python.analysis.diagnosticMode": "workspace",
|
||||||
"python.testing.pytestArgs": [
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"python.testing.unittestEnabled": false,
|
"python.testing.unittestEnabled": false,
|
||||||
"python.testing.pytestEnabled": true,
|
"python.testing.pytestEnabled": true,
|
||||||
|
"python.testing.pytestArgs": [
|
||||||
|
"--import-mode=importlib",
|
||||||
|
"test",
|
||||||
|
],
|
||||||
|
|
||||||
"black-formatter.importStrategy": "fromEnvironment",
|
"black-formatter.importStrategy": "fromEnvironment",
|
||||||
"flake8.importStrategy": "fromEnvironment",
|
"flake8.importStrategy": "fromEnvironment",
|
||||||
}
|
"isort.importStrategy": "fromEnvironment",
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import colorsys
|
import colorsys
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Self, TypeAlias, cast
|
from typing import AnyStr, Self, TypeAlias
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image as PILImage
|
from PIL import Image as PILImage
|
||||||
|
|
@ -56,7 +56,7 @@ class AdventImage:
|
||||||
async def get_text_box(
|
async def get_text_box(
|
||||||
self,
|
self,
|
||||||
xy: _XY,
|
xy: _XY,
|
||||||
text: str | bytes,
|
text: AnyStr,
|
||||||
font: FreeTypeFont,
|
font: FreeTypeFont,
|
||||||
anchor: str | None = "mm",
|
anchor: str | None = "mm",
|
||||||
**text_kwargs,
|
**text_kwargs,
|
||||||
|
|
@ -95,12 +95,12 @@ class AdventImage:
|
||||||
pixel_data = np.asarray(self.img.crop(box))
|
pixel_data = np.asarray(self.img.crop(box))
|
||||||
mean_color: np.ndarray = np.mean(pixel_data, axis=(0, 1))
|
mean_color: np.ndarray = np.mean(pixel_data, axis=(0, 1))
|
||||||
|
|
||||||
return cast(_RGB, tuple(mean_color.astype(int)))
|
return _RGB(mean_color.astype(int))
|
||||||
|
|
||||||
async def hide_text(
|
async def hide_text(
|
||||||
self,
|
self,
|
||||||
xy: _XY,
|
xy: _XY,
|
||||||
text: str | bytes,
|
text: AnyStr,
|
||||||
font: FreeTypeFont,
|
font: FreeTypeFont,
|
||||||
anchor: str | None = "mm",
|
anchor: str | None = "mm",
|
||||||
**text_kwargs,
|
**text_kwargs,
|
||||||
|
|
@ -135,14 +135,14 @@ class AdventImage:
|
||||||
tc_v -= 3
|
tc_v -= 3
|
||||||
|
|
||||||
text_color = colorsys.hsv_to_rgb(tc_h, tc_s, tc_v)
|
text_color = colorsys.hsv_to_rgb(tc_h, tc_s, tc_v)
|
||||||
text_color = tuple(int(val) for val in text_color)
|
text_color = _RGB(int(val) for val in text_color)
|
||||||
|
|
||||||
# Buchstaben verstecken
|
# Buchstaben verstecken
|
||||||
ImageDraw.Draw(self.img).text(
|
ImageDraw.Draw(self.img).text(
|
||||||
xy=xy,
|
xy=xy,
|
||||||
text=text,
|
text=text,
|
||||||
font=font,
|
font=font,
|
||||||
fill=cast(_RGB, text_color),
|
fill=text_color,
|
||||||
anchor=anchor,
|
anchor=anchor,
|
||||||
**text_kwargs,
|
**text_kwargs,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ from typing import Callable, Hashable
|
||||||
import requests
|
import requests
|
||||||
from cachetools.keys import hashkey
|
from cachetools.keys import hashkey
|
||||||
from CacheToolsUtils import RedisCache as __RedisCache
|
from CacheToolsUtils import RedisCache as __RedisCache
|
||||||
from redis.commands.core import ResponseT
|
from redis.typing import EncodableT, ResponseT
|
||||||
from redis.typing import EncodableT
|
|
||||||
from webdav3.client import Client as __WebDAVclient
|
from webdav3.client import Client as __WebDAVclient
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
2407
api/poetry.lock
generated
2407
api/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -9,24 +9,24 @@ name = "advent22_api"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
Pillow = "^10.2.0"
|
Pillow = "^12.1.1"
|
||||||
asyncify = "^0.9.2"
|
asyncify = "^0.12.1"
|
||||||
cachetools = "^5.3.3"
|
cachetools = "^7.0.1"
|
||||||
cachetoolsutils = "^8.5"
|
cachetoolsutils = "^11.0"
|
||||||
fastapi = "^0.103.1"
|
fastapi = "^0.129.0"
|
||||||
markdown = "^3.6"
|
markdown = "^3.10.2"
|
||||||
numpy = "^1.26.4"
|
numpy = "^2.4.2"
|
||||||
pydantic-settings = "^2.2.1"
|
pydantic-settings = "^2.13.0"
|
||||||
python = ">=3.11,<3.13"
|
python = ">=3.11,<3.15"
|
||||||
redis = {extras = ["hiredis"], version = "^5.0.3"}
|
redis = {extras = ["hiredis"], version = "^7.1.1"}
|
||||||
tomli-w = "^1.0.0"
|
tomli-w = "^1.2.0"
|
||||||
uvicorn = {extras = ["standard"], version = "^0.23.2"}
|
uvicorn = {extras = ["standard"], version = "^0.40.0"}
|
||||||
webdavclient3 = "^3.14.6"
|
webdavclient3 = "^3.14.7"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
black = "^24.3.0"
|
black = "^26.1.0"
|
||||||
flake8 = "^7.0.0"
|
flake8 = "^7.3.0"
|
||||||
pytest = "^8.1.1"
|
pytest = "^9.0.2"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue