Skip to content

Commit d00824a

Browse files
authoredFeb 6, 2025··
build: use uv (#116)
1 parent 7bf6c85 commit d00824a

12 files changed

+500
-925
lines changed
 

‎.github/codecov.yml

-13
This file was deleted.

‎.github/workflows/ci.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
submodules: "true"
18+
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version-file: ".python-version"
22+
23+
- uses: astral-sh/setup-uv@v5
24+
- run: uv sync --frozen
25+
- run: uv run python -m pytest -rva

‎.github/workflows/lint.yaml

+11-17
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,46 @@ name: lint
22

33
on:
44
push:
5-
branches-ignore:
6-
- renovate/**
7-
paths-ignore:
8-
- "**.md"
5+
branches:
6+
- master
97
pull_request:
108
branches:
119
- master
12-
paths-ignore:
13-
- "**.md"
1410

1511
jobs:
1612
mypy:
1713
runs-on: ubuntu-latest
1814
steps:
1915
- uses: actions/checkout@v4
2016
with:
21-
submodules: 'true'
17+
submodules: "true"
2218

2319
- uses: actions/setup-python@v5
2420
with:
25-
python-version: "3.10"
21+
python-version-file: ".python-version"
2622

27-
- uses: Trim21/setup-poetry@dist/v2
28-
29-
- uses: Trim21/install-poetry-project@dist/v2
23+
- uses: astral-sh/setup-uv@v5
24+
- run: uv sync --frozen
3025

3126
- uses: liskin/gh-problem-matcher-wrap@v3
3227
with:
3328
action: add
3429
linters: mypy
35-
run: ''
3630

3731
- name: mypy
38-
run: mypy --show-column-numbers app
32+
run: uv run mypy --show-column-numbers .
3933

4034
pre-commit:
4135
runs-on: ubuntu-latest
4236
steps:
4337
- uses: actions/checkout@v4
4438
with:
45-
submodules: 'true'
39+
submodules: "true"
4640

4741
- uses: actions/setup-python@v5
4842
with:
49-
python-version: "3.10"
43+
python-version-file: ".python-version"
44+
45+
- run: pip install pre-commit
5046

51-
- uses: trim21/setup-poetry@dist/v2
52-
- uses: trim21/install-poetry-project@dist/v2
5347
- uses: trim21/actions/pre-commit@master

‎.github/workflows/release-docker.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222
with:
23-
submodules: true
23+
submodules: 'true'
2424

2525
- uses: docker/login-action@v3
2626
with:

‎.github/workflows/test.yaml

-30
This file was deleted.

‎.pre-commit-config.yaml

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
exclude: "api/.*"
22
repos:
3+
- repo: https://github.com/astral-sh/uv-pre-commit
4+
rev: "0.5.29"
5+
hooks:
6+
- id: uv-lock
7+
38
- repo: https://github.com/pre-commit/pre-commit-hooks
49
rev: v5.0.0
510
hooks:
@@ -20,14 +25,6 @@ repos:
2025
args: [--fix=lf]
2126
- id: end-of-file-fixer
2227

23-
- repo: https://github.com/python-poetry/poetry
24-
rev: "1.8.4"
25-
hooks:
26-
- id: poetry-check
27-
- id: poetry-lock
28-
name: poetry-lock-check
29-
args: [--check]
30-
3128
- repo: https://github.com/astral-sh/ruff-pre-commit
3229
# Ruff version.
3330
rev: v0.8.1

‎Dockerfile

+7-21
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
# syntax=docker/dockerfile:1@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5
2-
3-
### convert poetry.lock to requirements.txt ###
4-
FROM python:3.10-slim@sha256:af6f1b19eae3400ea3a569ba92d4819a527be4662971d51bb798c923bba30a81 AS poetry
1+
FROM ghcr.io/astral-sh/uv:debian-slim@sha256:3ac4e2ef46fd5a0fb0cf5af9a421435513fec1b2a66e1379a7981dc03470fd33 AS build
52

63
WORKDIR /app
74

8-
ENV PIP_ROOT_USER_ACTION=ignore
9-
10-
COPY requirements-poetry.txt ./
11-
RUN pip install -r requirements-poetry.txt
5+
COPY uv.lock pyproject.toml ./
126

13-
COPY pyproject.toml poetry.lock ./
14-
RUN poetry export -f requirements.txt --output requirements.txt
7+
RUN uv export --no-group dev --frozen --no-emit-project > /app/requirements.txt
158

16-
### final image ###
17-
FROM python:3.10-slim@sha256:af6f1b19eae3400ea3a569ba92d4819a527be4662971d51bb798c923bba30a81
18-
19-
WORKDIR /app
20-
21-
ENV PYTHONPATH=/app
22-
23-
COPY --from=poetry /app/requirements.txt ./requirements.txt
9+
FROM python:3.10-slim@sha256:66aad90b231f011cb80e1966e03526a7175f0586724981969b23903abac19081
2410

2511
ENV PIP_ROOT_USER_ACTION=ignore
12+
WORKDIR /app
2613

27-
RUN pip install -U pip && \
28-
pip install -r requirements.txt
14+
COPY --from=build /app/requirements.txt .
2915

30-
WORKDIR /app
16+
RUN pip install --only-binary=:all: --no-cache --no-deps -r requirements.txt
3117

3218
COPY . .

‎poetry.lock

-787
This file was deleted.

‎pyproject.toml

+29-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1-
[tool.poetry]
2-
package-mode = false
3-
4-
[tool.poetry.dependencies]
5-
python = "^3.10"
6-
# dependencies
7-
pymemcache = "4.0.0"
8-
msgspec = "0.18.6"
9-
bgm-tv-wiki = "0.0.29"
10-
sqlalchemy = "2.0.36"
11-
pymysql = "1.1.1"
12-
pyyaml = "6.0.2"
13-
sslog = "0.0.0a51"
14-
confluent-kafka = "2.6.1"
15-
16-
[tool.poetry.group.dev.dependencies]
17-
tqdm = "4.67.1"
18-
# linter and formatter
19-
pre-commit = "==4.0.1"
20-
mypy = "==1.13.0"
21-
pytest = "8.3.3"
22-
pytest-github-actions-annotate-failures = "0.2.0"
23-
types-pyyaml = "^6.0.12.20240917"
24-
types-confluent-kafka = { version = '1.3.1', python = '>=3.10,<3.13' }
1+
[project]
2+
name = "project"
3+
version = "0"
4+
requires-python = "~=3.10.16"
5+
dependencies = [
6+
'msgspec == 0.18.6',
7+
'sslog == 0.0.0a51',
8+
'pymemcache == 4.0.0',
9+
'bgm-tv-wiki == 0.0.29',
10+
'sqlalchemy == 2.0.36',
11+
'pymysql == 1.1.1',
12+
'pyyaml == 6.0.2',
13+
'confluent-kafka == 2.6.1',
14+
]
15+
16+
[dependency-groups]
17+
dev = [
18+
'tqdm == 4.67.1',
19+
# linter and formatter
20+
'pre-commit ==4.0.1',
21+
'mypy ==1.13.0',
22+
'pytest == 8.3.3',
23+
'pytest-github-actions-annotate-failures == 0.2.0',
24+
'types-pyyaml == 6.0.12.20240917',
25+
'types-confluent-kafka == 1.3.1',
26+
]
27+
28+
[tool.uv]
29+
package = false
2530

2631
[tool.coverage.run]
2732
concurrency = ['thread', 'greenlet']

‎requirements-poetry.txt

-2
This file was deleted.

‎taskfile.yaml

-22
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,3 @@ tasks:
2929
dotenv: [ .env ]
3030
cmds:
3131
- python {{.CLI_ARGS}}
32-
33-
lock:no-cache:
34-
cmds:
35-
- poetry lock --no-update --no-cache
36-
- dos2unix.exe poetry.lock
37-
- poetry install --sync
38-
39-
update:
40-
cmds:
41-
- poetry update
42-
- dos2unix.exe poetry.lock
43-
- poetry install --sync
44-
45-
lock:
46-
cmds:
47-
- poetry lock --no-update
48-
- dos2unix.exe poetry.lock
49-
- poetry install --sync
50-
51-
sync:
52-
cmds:
53-
- poetry install --sync

‎uv.lock

+422
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.