Skip to content

Commit c90d57f

Browse files
authored
Merge pull request #12 from hexlet-components/feature/migrate-to-uv-ruff
Migrate to uv/ruff, update all dependencies
2 parents a8e37a5 + 12fa5ee commit c90d57f

8 files changed

Lines changed: 480 additions & 468 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
version: 2
33
updates:
4-
# === GitHub Actions ===
54
- package-ecosystem: github-actions
65
directory: /
76
schedule:
@@ -14,46 +13,13 @@ updates:
1413
actions-major:
1514
patterns: ["*"]
1615
update-types: [major]
17-
# === Python dev (pip) ===
18-
- package-ecosystem: pip
19-
directory: /
20-
schedule:
21-
interval: weekly
22-
labels: [dependencies, automated, dev]
23-
groups:
24-
pip-dev-minor-patch:
25-
patterns:
26-
- pytest*
27-
- flake8*
28-
- black
29-
- isort
30-
- mypy*
31-
- coverage*
32-
- tox*
33-
- ruff
34-
- pylint*
35-
- bandit
36-
- pre-commit
37-
- sphinx*
38-
- mkdocs*
39-
update-types: [minor, patch]
40-
# === Python runtime (pip) ===
41-
- package-ecosystem: pip
42-
directory: /
43-
schedule:
44-
interval: weekly
45-
labels: [dependencies, automated, runtime]
46-
groups:
47-
pip-runtime-minor-patch:
48-
patterns: ["*"]
49-
update-types: [minor, patch]
50-
# === Python (uv) ===
16+
5117
- package-ecosystem: uv
5218
directory: /
5319
schedule:
5420
interval: weekly
5521
labels: [dependencies, automated, uv]
56-
# === Docker ===
22+
5723
- package-ecosystem: docker
5824
directory: /
5925
schedule:

.github/workflows/python-ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ jobs:
1717

1818
- name: Set up Python
1919
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
25+
26+
- name: Install dependencies
27+
run: uv sync
2028

21-
- name: Setup project
22-
run: |
23-
pip install poetry
24-
make install
29+
- name: Lint
30+
run: make lint
2531

2632
deploy:
2733
needs: build

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ RUN apt-get update && apt-get install -yqq \
66
sudo \
77
curl
88

9-
RUN pip install poetry
9+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
1010

11-
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
11+
ENV UV_COMPILE_BYTECODE=1 \
12+
UV_LINK_MODE=copy
1213

1314
WORKDIR /app
1415

15-
COPY pyproject.toml .
16+
COPY pyproject.toml uv.lock ./
1617

17-
RUN poetry install
18+
RUN uv sync --frozen --no-dev --no-install-project
1819

1920
COPY . .
2021

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
PORT ?= 8000
22

33
install:
4-
poetry install
4+
uv sync
55

66
lint:
7-
poetry run flake8
7+
uv run ruff check .
8+
uv run ruff format --check .
89

910
test:
10-
poetry run pytest -vv tests
11+
uv run pytest -vv tests
1112

1213
check: test lint
1314

1415
run:
15-
poetry run flask --app example --debug run --host 0.0.0.0 --port $(PORT)
16+
uv run flask --app example --debug run --host 0.0.0.0 --port $(PORT)
1617

1718
prod:
18-
poetry run gunicorn --workers=4 --bind 0.0.0.0:$(PORT) example:app --log-file -
19+
uv run gunicorn --workers=4 --bind 0.0.0.0:$(PORT) example:app --log-file -
1920

2021
compose-production-run:
2122
docker compose -p python_page_analyzer_ru-production down

poetry.lock

Lines changed: 0 additions & 337 deletions
This file was deleted.

pyproject.toml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1-
[tool.poetry]
1+
[project]
22
name = "python-flask-example"
33
version = "0.1.0"
44
description = "A simple Flask app"
5-
authors = ["Hexlet Team <info@hexlet.io>"]
6-
license = "ISC"
75
readme = "README.md"
8-
package-mode = false
6+
license = { text = "ISC" }
7+
requires-python = ">=3.10"
8+
dependencies = [
9+
"flask>=3.1.1",
10+
"gunicorn>=23.0.0",
11+
"psycopg2-binary>=2.9.10",
12+
]
913

10-
[tool.poetry.dependencies]
11-
python = "^3.10"
12-
Flask = "^3.0.3"
13-
gunicorn = "^23.0.0"
14-
psycopg2-binary = "^2.9.9"
14+
[dependency-groups]
15+
dev = [
16+
"pytest>=8.3.5",
17+
"ruff>=0.11.0",
18+
]
1519

16-
[tool.poetry.group.dev.dependencies]
17-
flake8 = "^7.1.1"
20+
[tool.ruff]
21+
line-length = 80
22+
exclude = [
23+
".git",
24+
"__pycache__",
25+
".venv",
26+
".eggs",
27+
"*.egg",
28+
".vscode",
29+
]
1830

19-
[build-system]
20-
requires = ["poetry-core"]
21-
build-backend = "poetry.core.masonry.api"
31+
[tool.ruff.lint]
32+
select = ["E", "F", "I"]
33+
34+
[tool.ruff.lint.per-file-ignores]
35+
"tests/*.py" = ["S101"]
36+
37+
[tool.ruff.format]
38+
quote-style = "double"

setup.cfg

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)