Skip to content

Commit 3305ad1

Browse files
authored
Merge pull request #30 from taskiq-python/uv_integration
Poetry -> UV
2 parents ef097a5 + 0162697 commit 3305ad1

13 files changed

Lines changed: 1960 additions & 1188 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,34 @@ name: Release python package
33
on:
44
push:
55
tags:
6-
- "*"
6+
- "v*"
77

88
jobs:
9-
deploy:
9+
publish:
1010
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
1115
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up Python
14-
uses: actions/setup-python@v2
16+
- name: Checkout
17+
uses: actions/checkout@v6
1518
with:
16-
python-version: "3.9"
17-
- name: Install deps
18-
uses: knowsuchagency/poetry-install@v1
19-
env:
20-
POETRY_VIRTUALENVS_CREATE: false
21-
- name: Set verison
22-
run: poetry version "${{ github.ref_name }}"
23-
- name: Release package
19+
persist-credentials: false
20+
fetch-depth: 0
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v7
24+
with:
25+
version: "latest"
26+
enable-cache: true
27+
cache-suffix: release-py3.14
28+
python-version: 3.14
29+
30+
- name: Build package
31+
run: uv build --no-sources
32+
33+
- name: Publish package
2434
env:
25-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
26-
run: poetry publish --build
35+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
36+
run: uv publish

.github/workflows/test.yml

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,45 @@ on: pull_request
44

55
jobs:
66
lint:
7-
strategy:
8-
matrix:
9-
cmd:
10-
- black
11-
- ruff
12-
- mypy
137
runs-on: ubuntu-latest
148
steps:
15-
- uses: actions/checkout@v2
16-
- name: Install poetry
17-
run: pipx install poetry
18-
- name: Set up Python
19-
uses: actions/setup-python@v4
9+
- uses: actions/checkout@v6
2010
with:
21-
python-version: "3.11"
22-
cache: "poetry"
11+
persist-credentials: false
12+
fetch-depth: 0
13+
- id: setup-uv
14+
uses: astral-sh/setup-uv@v7
15+
with:
16+
enable-cache: true
17+
cache-suffix: 3.14
18+
version: "latest"
19+
python-version: 3.14
2320
- name: Install deps
24-
run: poetry install --all-extras
21+
run: uv sync --frozen --all-extras
2522
- name: Run lint check
26-
run: poetry run pre-commit run -a ${{ matrix.cmd }}
23+
run: uv run pre-commit run -a
2724
pytest:
2825
strategy:
2926
matrix:
30-
py_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
31-
runs-on: "ubuntu-latest"
27+
py_version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
28+
pydantic_ver: [ "<2", ">=2.5,<3" ]
29+
os: [ ubuntu-latest, windows-latest, macos-latest ]
30+
runs-on: "${{ matrix.os }}"
3231
steps:
33-
- uses: actions/checkout@v2
34-
- name: Set up Python
35-
uses: actions/setup-python@v2
32+
- uses: actions/checkout@v6
33+
with:
34+
persist-credentials: false
35+
fetch-depth: 0
36+
- id: setup-uv
37+
uses: astral-sh/setup-uv@v7
3638
with:
37-
python-version: "${{ matrix.py_version }}"
38-
- name: Update pip
39-
run: python -m pip install -U pip
40-
- name: Install poetry
41-
run: python -m pip install poetry
39+
enable-cache: true
40+
cache-suffix: ${{ matrix.py_version }}
41+
version: "latest"
42+
python-version: ${{ matrix.py_version }}
4243
- name: Install deps
43-
run: poetry install
44-
env:
45-
POETRY_VIRTUALENVS_CREATE: false
44+
run: uv sync --frozen --all-extras
45+
- name: Setup pydantic version
46+
run: uv pip install "pydantic ${{ matrix.pydantic_ver }}"
4647
- name: Run pytest check
47-
run: poetry run pytest -vv -n auto --cov="taskiq_pipelines" .
48+
run: uv run pytest -vv -n auto .

.pre-commit-config.yaml

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,64 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3+
34
repos:
45
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v2.4.0
6+
rev: v6.0.0
67
hooks:
7-
- id: check-ast
8-
- id: trailing-whitespace
8+
- id: check-added-large-files
9+
- id: pretty-format-json
10+
args:
11+
- "--indent=2"
12+
- "--autofix"
13+
- id: check-json
14+
- id: check-yaml
15+
exclude: .github/
916
- id: check-toml
1017
- id: end-of-file-fixer
18+
- id: trailing-whitespace
1119

1220
- repo: https://github.com/asottile/add-trailing-comma
13-
rev: v2.1.0
21+
rev: v4.0.0
1422
hooks:
1523
- id: add-trailing-comma
1624

17-
- repo: local
25+
- repo: https://github.com/crate-ci/typos
26+
rev: v1
1827
hooks:
19-
- id: black
20-
name: Format with Black
21-
entry: poetry run black
22-
language: system
23-
types: [python]
28+
- id: typos
2429

25-
- id: ruff
26-
name: Run ruff lints
27-
entry: poetry run ruff
28-
language: system
29-
pass_filenames: false
30-
types: [python]
31-
args:
32-
- "check"
33-
- "--fix"
34-
- "."
30+
- repo: https://github.com/Yelp/detect-secrets
31+
rev: v1.5.0
32+
hooks:
33+
- id: detect-secrets
34+
35+
- repo: https://github.com/astral-sh/uv-pre-commit
36+
rev: 0.11.7
37+
hooks:
38+
- id: uv-lock
3539

40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: v0.15.12
42+
hooks:
43+
- id: ruff-format
44+
- id: ruff-check
45+
args: [ --fix, --unsafe-fixes ]
46+
47+
- repo: https://github.com/pre-commit/mirrors-mypy
48+
rev: 'v1.20.2'
49+
hooks:
3650
- id: mypy
37-
name: Validate types with MyPy
38-
entry: poetry run mypy
51+
additional_dependencies:
52+
- "no_implicit_optional"
53+
- "pydantic>=2,<3"
54+
- "taskiq>=0.11.12,<1"
55+
- "typing-extensions>=4.3.0,<5"
56+
args: [ "--config-file=pyproject.toml", "--install-types", "--non-interactive" ]
57+
58+
- repo: local
59+
hooks:
60+
- id: black
61+
name: Format with Black
62+
entry: uv run black
3963
language: system
4064
types: [python]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def main():
7575
.map(add_one) # Here we execute given function for each value.
7676
# [3, 3, 3, 3]
7777
.filter(check) # Here we filter some values.
78-
# But sice our filter filters out all numbers less than zero,
78+
# But since our filter filters out all numbers less than zero,
7979
# our value won't change.
8080
# [3, 3, 3, 3]
8181
)
@@ -101,7 +101,7 @@ Two notable things here:
101101
2. We can use only tasks as functions we wan to execute in pipeline.
102102
If you want to execute ordinary python function - you must wrap it in task.
103103

104-
Pipeline itself is just a convinient wrapper over list of steps.
104+
Pipeline itself is just a convenient wrapper over list of steps.
105105
Constructed pipeline has the same semantics as the ordinary task, and you can add steps
106106
manually. But all steps of the pipeline must implement `taskiq_pipelines.abc.AbstractStep` class.
107107

0 commit comments

Comments
 (0)