Skip to content

Commit a5b9e05

Browse files
committed
refactor: remove support for deprecated Python versions and move to uv
1 parent b720884 commit a5b9e05

File tree

7 files changed

+96
-1390
lines changed

7 files changed

+96
-1390
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@ name: Release python package
33
on:
44
push:
55
tags:
6-
- "*"
6+
- released
77

88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
1113
steps:
12-
- uses: actions/checkout@v4
13-
- name: Install poetry
14-
run: pipx install poetry
15-
- name: Set up Python
16-
uses: actions/setup-python@v4
14+
- uses: actions/checkout@v5
1715
with:
18-
python-version: "3.11"
19-
- name: Install deps
20-
run: poetry install
16+
persist-credentials: false
17+
- uses: astral-sh/setup-uv@v7
18+
with:
19+
enable-cache: false
20+
python-version: "3.12"
21+
version: "latest"
22+
- run: uv version "${GITHUB_REF_NAME}"
23+
- run: uv build
2124
- name: Release package
2225
env:
23-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
24-
run: poetry publish --build
26+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
27+
run: uv publish

.github/workflows/test.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@ jobs:
66
lint:
77
strategy:
88
matrix:
9-
cmd:
10-
- black
11-
- mypy
12-
- ruff
9+
cmd: [ "black", "ruff", "mypy" ]
1310
runs-on: ubuntu-latest
1411
steps:
15-
- uses: actions/checkout@v4
16-
- name: Install poetry
17-
run: pipx install poetry
18-
- name: Set up Python
19-
uses: actions/setup-python@v4
12+
- uses: actions/checkout@v5
2013
with:
21-
python-version: "3.11"
22-
cache: "poetry"
14+
persist-credentials: false
15+
- id: setup-uv
16+
uses: astral-sh/setup-uv@v7
17+
with:
18+
enable-cache: true
19+
cache-suffix: "3.12"
20+
version: "latest"
21+
python-version: "3.12"
2322
- name: Install deps
24-
run: poetry install
23+
run: uv sync --all-extras
2524
- name: Run lint check
26-
run: poetry run pre-commit run -a ${{ matrix.cmd }}
25+
run: uv run pre-commit run -a ${{ matrix.cmd }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ celerybeat.pid
122122
# Environments
123123
.env
124124
.venv
125+
.venv/
125126
env/
126127
venv/
127128
ENV/

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ repos:
1818
hooks:
1919
- id: black
2020
name: Format with Black
21-
entry: poetry run black
21+
entry: uv run black
2222
language: system
2323
types: [python]
2424

2525
- id: mypy
2626
name: Validate types with MyPy
27-
entry: poetry run mypy
27+
entry: uv run mypy
2828
language: system
2929
types: [python]
3030
pass_filenames: false
3131
args: [taskiq_litestar]
3232

3333
- id: ruff
3434
name: Run ruff lints
35-
entry: poetry run ruff
35+
entry: uv run ruff
3636
language: system
3737
pass_filenames: false
3838
types: [python]

poetry.lock

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

pyproject.toml

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,43 @@
1-
[tool.poetry]
1+
[project]
22
name = "taskiq-litestar"
33
description = "Taskiq integration with litestar"
4-
authors = ["Taskiq team <[email protected]>"]
5-
maintainers = ["Taskiq team <[email protected]>"]
4+
authors = [
5+
{ name = "Taskiq team", email = "[email protected]" }
6+
]
7+
maintainers = [
8+
{ name = "Taskiq team", email = "[email protected]" }
9+
]
610
version = "0.1.1"
711
readme = "README.md"
8-
license = "LICENSE"
12+
license = { file = "LICENSE" }
913
classifiers = [
1014
"Typing :: Typed",
1115
"Programming Language :: Python",
1216
"Programming Language :: Python :: 3",
1317
"Programming Language :: Python :: 3 :: Only",
14-
"Programming Language :: Python :: 3.8",
15-
"Programming Language :: Python :: 3.9",
1618
"Programming Language :: Python :: 3.10",
1719
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: 3.13",
1822
"Operating System :: OS Independent",
1923
"Intended Audience :: Developers",
2024
"Topic :: System :: Networking",
2125
"Development Status :: 3 - Alpha",
2226
]
2327
keywords = ["taskiq", "tasks", "distributed", "async", "litestar"]
24-
packages = [{ include = "taskiq_litestar" }]
25-
26-
[tool.poetry.dependencies]
27-
python = "^3.8.1"
28-
taskiq = "^0"
29-
litestar = "^2"
28+
dependencies = [
29+
"taskiq>=0.8.0",
30+
"litestar>=2,<=3",
31+
]
3032

31-
[tool.poetry.group.dev.dependencies]
32-
mypy = "^1"
33-
pre-commit = "^2.20.0"
34-
black = "^23.1.0"
35-
ruff = "^0.0.292"
33+
[project.optional-dependencies]
34+
dev = [
35+
"mypy>=1.0.0,<2.0.0",
36+
"pre-commit>=2.20.0,<3.0.0",
37+
"coverage>=6.4.2,<7.0.0",
38+
"black>=23.1.0,<24.0.0",
39+
"ruff>=0.6.0,<1.0.0",
40+
]
3641

3742
[tool.mypy]
3843
strict = true
@@ -47,57 +52,63 @@ warn_return_any = false
4752
warn_unused_ignores = false
4853

4954
[build-system]
50-
requires = ["poetry-core"]
51-
build-backend = "poetry.core.masonry.api"
55+
requires = ["hatchling>=1.21"]
56+
build-backend = "hatchling.build"
57+
58+
[tool.hatch.build.targets.wheel]
59+
packages = ["taskiq_litestar"]
5260

5361
[tool.ruff]
5462
# List of enabled rulsets.
5563
# See https://docs.astral.sh/ruff/rules/ for more information.
56-
select = [
57-
"E", # Error
58-
"F", # Pyflakes
59-
"W", # Pycodestyle
64+
line-length = 88
65+
66+
lint.select = [
67+
"E", # Error
68+
"F", # Pyflakes
69+
"W", # Pycodestyle
6070
"C90", # McCabe complexity
61-
"I", # Isort
62-
"N", # pep8-naming
63-
"D", # Pydocstyle
71+
"I", # Isort
72+
"N", # pep8-naming
73+
"D", # Pydocstyle
6474
"ANN", # Pytype annotations
65-
"S", # Bandit
66-
"B", # Bugbear
75+
"S", # Bandit
76+
"B", # Bugbear
6777
"COM", # Commas
68-
"C4", # Comprehensions
78+
"C4", # Comprehensions
6979
"ISC", # Implicit string concat
7080
"PIE", # Unnecessary code
7181
"T20", # Catch prints
7282
"PYI", # validate pyi files
73-
"Q", # Checks for quotes
83+
"Q", # Checks for quotes
7484
"RSE", # Checks raise statements
7585
"RET", # Checks return statements
7686
"SLF", # Self checks
7787
"SIM", # Simplificator
7888
"PTH", # Pathlib checks
7989
"ERA", # Checks for commented out code
80-
"PL", # PyLint checks
90+
"PL", # PyLint checks
8191
"RUF", # Specific to Ruff checks
92+
"FA102", # Future annotations
93+
"UP", # Pyupgrade
8294
]
83-
ignore = [
84-
"D105", # Missing docstring in magic method
85-
"D107", # Missing docstring in __init__
86-
"D212", # Multi-line docstring summary should start at the first line
87-
"D401", # First line should be in imperative mood
88-
"D104", # Missing docstring in public package
89-
"D100", # Missing docstring in public module
90-
"ANN102", # Missing type annotation for self in method
91-
"ANN101", # Missing type annotation for argument
92-
"ANN401", # typing.Any are disallowed in `**kwargs
95+
lint.ignore = [
96+
"D105", # Missing docstring in magic method
97+
"D107", # Missing docstring in __init__
98+
"D212", # Multi-line docstring summary should start at the first line
99+
"D401", # First line should be in imperative mood
100+
"D104", # Missing docstring in public package
101+
"D100", # Missing docstring in public module
102+
"ANN401", # typing.Any are disallowed in `**kwargs
93103
"PLR0913", # Too many arguments for function call
94-
"D106", # Missing docstring in public nested class
104+
"D106", # Missing docstring in public nested class
95105
]
96106
exclude = [".venv/"]
97-
mccabe = { max-complexity = 10 }
98-
line-length = 88
99107

100-
[tool.ruff.per-file-ignores]
108+
[tool.ruff.lint.mccabe]
109+
max-complexity = 10
110+
111+
[tool.ruff.lint.per-file-ignores]
101112
"tests/*" = [
102113
"S101", # Use of assert detected
103114
"S301", # Use of pickle detected
@@ -107,14 +118,14 @@ line-length = 88
107118
"D101", # Missing docstring in public class
108119
]
109120

110-
[tool.ruff.pydocstyle]
121+
[tool.ruff.lint.pydocstyle]
111122
convention = "pep257"
112123
ignore-decorators = ["typing.overload"]
113124

114-
[tool.ruff.pylint]
115-
allow-magic-value-types = ["int", "str", "float", "tuple"]
125+
[tool.ruff.lint.pylint]
126+
allow-magic-value-types = ["int", "str", "float"]
116127

117-
[tool.ruff.flake8-bugbear]
128+
[tool.ruff.lint.flake8-bugbear]
118129
extend-immutable-calls = [
119130
"taskiq_dependencies.Depends",
120131
"taskiq.TaskiqDepends",

taskiq_litestar/intializer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
from __future__ import annotations
2+
13
import logging
2-
from typing import Awaitable, Callable
4+
from collections.abc import Awaitable, Callable
35

46
from litestar import Litestar
57
from litestar.datastructures import State
@@ -10,8 +12,8 @@
1012

1113

1214
def startup_event_generator(
13-
broker: AsyncBroker,
14-
app_path: str,
15+
broker: AsyncBroker,
16+
app_path: str,
1517
) -> Callable[[TaskiqState], Awaitable[None]]:
1618
"""
1719
Generate a startup event.
@@ -39,7 +41,7 @@ async def startup_event(state: TaskiqState) -> None:
3941

4042

4143
def shutdown_event_generator(
42-
broker: AsyncBroker,
44+
broker: AsyncBroker,
4345
) -> Callable[[TaskiqState], Awaitable[None]]:
4446
"""
4547
Generate shutdown event.

0 commit comments

Comments
 (0)