Skip to content

Commit 26660b9

Browse files
authored
Merge pull request #26 from fennr/chore/uv-migration
chore: replace poetry with uv
2 parents bcb2d78 + 49f4e29 commit 26660b9

File tree

8 files changed

+1639
-967
lines changed

8 files changed

+1639
-967
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
name: Release python package
22

33
on:
4-
push:
5-
tags:
6-
- "*"
4+
release:
5+
types:
6+
- released
77

88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11+
environment:
12+
name: release
13+
permissions:
14+
id-token: write
1115
steps:
12-
- uses: actions/checkout@v2
13-
- name: Install poetry
14-
run: pipx install poetry
15-
- name: Set up Python
16-
uses: actions/setup-python@v4
16+
- uses: actions/checkout@v5
1717
with:
18-
python-version: "3.9"
19-
- name: Install deps
20-
run: poetry install
21-
- name: Set version
22-
run: poetry version "${{ github.ref_name }}"
18+
persist-credentials: false
19+
- uses: astral-sh/setup-uv@v7
20+
with:
21+
enable-cache: false
22+
python-version: "3.12"
23+
version: "latest"
24+
- run: uv version "${GITHUB_REF_NAME}"
25+
- run: uv build
2326
- name: Release package
2427
env:
25-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
26-
run: poetry publish --build
28+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
29+
run: uv publish

.github/workflows/test.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
name: Testing package
22

33
on:
4-
- push
5-
- pull_request
4+
pull_request:
5+
paths-ignore:
6+
- '*.md'
7+
push:
8+
paths-ignore:
9+
- '*.md'
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
pull-requests: read
15+
616

717
jobs:
818
lint:
919
strategy:
1020
matrix:
11-
cmd:
12-
- black
13-
- mypy
14-
- ruff
21+
cmd: ["black", "ruff", "mypy"]
1522
runs-on: ubuntu-latest
1623
steps:
17-
- uses: actions/checkout@v2
18-
- name: Install poetry
19-
run: pipx install poetry
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
24+
- uses: actions/checkout@v5
25+
with:
26+
persist-credentials: false
27+
- id: setup-uv
28+
uses: astral-sh/setup-uv@v7
2229
with:
23-
python-version: "3.9"
24-
cache: "poetry"
30+
enable-cache: true
31+
cache-suffix: 3.11
32+
version: "latest"
33+
python-version: 3.11
2534
- name: Install deps
26-
run: poetry install
35+
run: uv sync --all-extras
2736
- name: Run lint check
28-
run: poetry run pre-commit run -a ${{ matrix.cmd }}
37+
run: uv run pre-commit run -a ${{ matrix.cmd }}

.pre-commit-config.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,45 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v2.4.0
5+
rev: v6.0.0
66
hooks:
77
- id: check-ast
88
- id: trailing-whitespace
99
- id: check-toml
1010
- id: end-of-file-fixer
1111

1212
- repo: https://github.com/asottile/add-trailing-comma
13-
rev: v2.1.0
13+
rev: v4.0.0
1414
hooks:
1515
- id: add-trailing-comma
1616

17+
- repo: https://github.com/crate-ci/typos
18+
rev: v1.38.1
19+
hooks:
20+
- id: typos
21+
22+
- repo: https://github.com/Yelp/detect-secrets
23+
rev: v1.5.0
24+
hooks:
25+
- id: detect-secrets
26+
1727
- repo: local
1828
hooks:
1929
- id: black
2030
name: Format with Black
21-
entry: poetry run black
31+
entry: uv run black
2232
language: system
2333
types: [python]
2434

2535
- id: mypy
2636
name: Validate types with MyPy
27-
entry: poetry run mypy
37+
entry: uv run mypy
2838
language: system
2939
types: [python]
3040

3141
- id: ruff
3242
name: Run ruff lints
33-
entry: poetry run ruff
43+
entry: uv run ruff
3444
language: system
3545
pass_filenames: false
3646
types: [python]

poetry.lock

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

pyproject.toml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
1-
[tool.poetry]
1+
[project]
22
name = "taskiq-fastapi"
33
description = "FastAPI integration for taskiq"
4-
authors = ["Taskiq team <taskiq@no-reply.com>"]
5-
maintainers = ["Taskiq team <taskiq@no-reply.com>"]
6-
version = "0.0.0"
74
readme = "README.md"
8-
license = "LICENSE"
5+
license = "MIT"
6+
license-files = ["LICENSE"]
7+
authors = [{ name = "Taskiq team", email = "taskiq@no-reply.com" }]
8+
maintainers = [{ name = "Taskiq team", email = "taskiq@no-reply.com" }]
9+
version = "0.0.0"
10+
requires-python = ">=3.10"
911
classifiers = [
1012
"Typing :: Typed",
1113
"Programming Language :: Python",
1214
"Programming Language :: Python :: 3",
1315
"Programming Language :: Python :: 3 :: Only",
14-
"Programming Language :: Python :: 3.8",
15-
"Programming Language :: Python :: 3.9",
1616
"Programming Language :: Python :: 3.10",
1717
"Programming Language :: Python :: 3.11",
18+
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
1820
"Operating System :: OS Independent",
1921
"Intended Audience :: Developers",
2022
"Topic :: System :: Networking",
2123
"Development Status :: 3 - Alpha",
2224
]
2325
keywords = ["taskiq", "tasks", "distributed", "async", "fastapi"]
24-
packages = [{ include = "taskiq_fastapi" }]
26+
dependencies = ["taskiq>=0.8.0", "fastapi>=0.93.0"]
2527

26-
[tool.poetry.dependencies]
27-
python = "^3.8.1"
28-
taskiq = "^0,>=0.8.0"
29-
fastapi = ">=0.93.0"
28+
[dependency-groups]
29+
dev = [
30+
"pre-commit>=4.4.0",
31+
# lint
32+
"ruff>=0.14.5",
33+
"black>=25.11.0",
34+
# type check
35+
"mypy>=1.18.2",
36+
# tests
37+
"pytest>=9.0.1",
38+
"pytest-cov>=7.0.0",
39+
"coverage>=7.11.3",
40+
]
3041

31-
[tool.poetry.group.dev.dependencies]
32-
mypy = "^1"
33-
pre-commit = "^2.20.0"
34-
coverage = "^6.4.2"
35-
black = "^23.1.0"
36-
ruff = "^0.6"
42+
[tool.uv_build.targets.wheel]
43+
packages = ["taskiq_fastapi"]
3744

3845
[tool.mypy]
3946
strict = true
@@ -47,10 +54,6 @@ allow_untyped_decorators = true
4754
warn_return_any = false
4855
warn_unused_ignores = false
4956

50-
[build-system]
51-
requires = ["poetry-core"]
52-
build-backend = "poetry.core.masonry.api"
53-
5457
[tool.ruff]
5558
# List of enabled rulsets.
5659
# See https://docs.astral.sh/ruff/rules/ for more information.
@@ -80,6 +83,7 @@ lint.select = [
8083
"ERA", # Checks for commented out code
8184
"PL", # PyLint checks
8285
"RUF", # Specific to Ruff checks
86+
"UP", # Pyupgrade: modernize syntax & type hints
8387
]
8488
lint.ignore = [
8589
"D105", # Missing docstring in magic method

taskiq_fastapi/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""FastAPI integration for Taskiq project."""
2+
23
from taskiq_fastapi.initializator import init, populate_dependency_context
34

45
__all__ = ["init", "populate_dependency_context"]

taskiq_fastapi/initializator.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import copy
2-
from typing import Any, Awaitable, Callable, Mapping, Optional, Union
2+
from collections.abc import Awaitable, Callable, Mapping
3+
from typing import Any
34

45
from fastapi import FastAPI, Request
56
from starlette.requests import HTTPConnection
@@ -9,7 +10,7 @@
910

1011
def startup_event_generator(
1112
broker: AsyncBroker,
12-
app_or_path: Union[str, FastAPI],
13+
app_or_path: str | FastAPI,
1314
) -> Callable[[TaskiqState], Awaitable[None]]:
1415
"""
1516
Generate shutdown event.
@@ -67,7 +68,7 @@ async def shutdown(state: TaskiqState) -> None:
6768
return shutdown
6869

6970

70-
def init(broker: AsyncBroker, app_or_path: Union[str, FastAPI]) -> None:
71+
def init(broker: AsyncBroker, app_or_path: str | FastAPI) -> None:
7172
"""
7273
Add taskiq startup events.
7374
@@ -95,7 +96,7 @@ def init(broker: AsyncBroker, app_or_path: Union[str, FastAPI]) -> None:
9596
def populate_dependency_context(
9697
broker: AsyncBroker,
9798
app: FastAPI,
98-
asgi_state: Optional[Mapping[str, Any]] = None,
99+
asgi_state: Mapping[str, Any] | None = None,
99100
) -> None:
100101
"""
101102
Populate dependency context.

0 commit comments

Comments
 (0)