migrate to uv

This commit is contained in:
Thephaseless 2024-12-10 22:16:30 +00:00
parent 3455ec6c04
commit 7397da1e2c
4 changed files with 1488 additions and 2280 deletions

View File

@ -1,35 +1,37 @@
FROM python:3.13-slim-bullseye FROM debian:bullseye-slim AS base
# Inspired by https://github.com/Hudrolax/uc-docker-alpine/ # Inspired by https://github.com/Hudrolax/uc-docker-alpine/
ARG GITHUB_BUILD=false ARG GITHUB_BUILD=false
ENV GITHUB_BUILD=${GITHUB_BUILD} ENV GITHUB_BUILD=${GITHUB_BUILD}
ARG VERSION
ENV VERSION=${VERSION}
ENV HOME=/root ENV HOME=/root
ENV \ ENV \
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files # prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \ PYTHONDONTWRITEBYTECODE=1 \
# do not ask any interactive question
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
DISPLAY=:0 DISPLAY=:0
WORKDIR /app WORKDIR /app
EXPOSE 8191
RUN apt update &&\ RUN apt update &&\
apt install -y xvfb scrot python3-tk curl chromium chromium-driver apt install -y xvfb scrot python3-tk curl chromium chromium-driver
RUN curl -sSL https://install.python-poetry.org | python3 - RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="${HOME}/.local/bin:$PATH" ENV PATH="${HOME}/.local/bin:$PATH"
COPY pyproject.toml poetry.lock ./ COPY pyproject.toml uv.lock ./
RUN poetry install RUN uv sync --no-group
COPY . . COPY . .
HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "http://localhost:8191/health" ]
RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && ln -s /usr/bin/chromedriver uc_driver RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && ln -s /usr/bin/chromedriver uc_driver
FROM base AS test
RUN uv sync --group test
RUN uv run pytest --retries 2 -n auto --xvfb
FROM base
EXPOSE 8191
HEALTHCHECK --interval=60s --timeout=30s --start-period=5s --retries=3 CMD [ "curl", "http://localhost:8191/health" ]
CMD ["./cmd.sh"] CMD ["./cmd.sh"]

2238
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,32 @@
[tool.poetry] # cspell:disable
[project]
authors = [{ name = "ThePhaseless", email = "kukubaorch@gmail.com" }]
license = { text = "LICENSE" }
requires-python = "<4.0,>=3.12"
name = "Byparr" name = "Byparr"
version = "0.1.0" version = "0.1.0"
description = "API for getting cookies for Cloudflare challenges" description = "API for getting cookies for Cloudflare challenges"
package-mode = false
authors = ["ThePhaseless <kukubaorch@gmail.com>"]
readme = "README.md" readme = "README.md"
license = "LICENSE" dependencies = [
repository = "https://github.com/ThePhaseless/Byparr" "beautifulsoup4>=4.12.3",
"fastapi[standard]>=0.115.6",
"pyautogui>=0.9.54",
"pydantic>=2.10.3",
"seleniumbase>=4.33.7",
"uvicorn>=0.32.1",
]
urls = { repository = "https://github.com/ThePhaseless/Byparr" }
# cspell:disable [dependency-groups]
[tool.poetry.dependencies] test = [
python = "^3.12" "httpx>=0.28.1",
fastapi = { extras = ["standard"], version = "^0" } "pytest>=8.3.4",
seleniumbase = "^4.33.1" "pytest-asyncio>=0.24.0",
beautifulsoup4 = "^4.12.3" "pytest-progress>=1.3.0",
uvicorn = "^0.32.1" "pytest-retry>=1.6.3",
pydantic = "^2.10.2" "pytest-xdist>=3.6.1",
pyautogui = "^0.9.54" ]
dev = ["deptry>=0.21.1", "ruff>=0.8.2"]
[tool.poetry.group.dev.dependencies]
ruff = "^0.8.0"
deptry = "^0.21.1"
[tool.poetry.group.test.dependencies]
pytest = "^8.3.3"
httpx = "^0.28.0"
pytest-retry = "^1.6.3"
pytest-progress = "^1.3.0"
pytest-asyncio = "^0"
pytest-xdist = "^3.6.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.deptry.per_rule_ignores] [tool.deptry.per_rule_ignores]
DEP002 = ["pyautogui"] DEP002 = ["pyautogui"]

1450
uv.lock generated Normal file

File diff suppressed because it is too large Load Diff