Skip to content

Commit 73304db

Browse files
authored
Merge pull request #28 from taskiq-python/develop
chore: add redis distribution, py3.12 support
2 parents 319e252 + b7d5d07 commit 73304db

File tree

6 files changed

+63
-32
lines changed

6 files changed

+63
-32
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Release python package
22

33
on:
4+
workflow_dispatch: null
45
push:
56
tags:
67
- "*"
@@ -18,7 +19,7 @@ jobs:
1819
- uses: actions/checkout@v4
1920

2021
- name: Set up Python
21-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
2223
with:
2324
python-version: "3.8"
2425
cache: "pip"
@@ -38,7 +39,7 @@ jobs:
3839
run: python -m build
3940

4041
- name: Publish
41-
uses: pypa/[email protected].10
42+
uses: pypa/[email protected].11
4243
with:
4344
password: ${{ secrets.PYPI_TOKEN }}
4445

.github/workflows/test.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/setup-python@v4
16+
- uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.8
18+
python-version: 3.9
1919
- name: Install Dependencies and library
2020
shell: bash
2121
run: |
2222
set -ux
2323
python -m pip install --upgrade pip
2424
pip install -e ".[dev]"
2525
26-
- name: Run black
26+
- name: Run formatter
2727
shell: bash
28-
run: black taskiq_faststream
28+
run: ruff format taskiq_faststream
2929

3030
- name: Run mypy
3131
shell: bash
@@ -40,13 +40,13 @@ jobs:
4040
runs-on: ubuntu-latest
4141
strategy:
4242
matrix:
43-
python-version: ["3.8", "3.9", "3.10", "3.11"]
43+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
4444
fail-fast: false
4545

4646
steps:
4747
- uses: actions/checkout@v4
4848
- name: Set up Python
49-
uses: actions/setup-python@v4
49+
uses: actions/setup-python@v5
5050
with:
5151
python-version: ${{ matrix.python-version }}
5252
- uses: actions/cache@v3
@@ -61,13 +61,14 @@ jobs:
6161
- name: Test
6262
run: bash scripts/test.sh
6363
env:
64-
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
65-
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
64+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
65+
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
6666
- name: Store coverage files
67-
uses: actions/upload-artifact@v3
67+
uses: actions/upload-artifact@v4
6868
with:
69-
name: coverage
69+
name: .coverage.${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
7070
path: coverage
71+
if-no-files-found: error
7172

7273
coverage-combine:
7374
needs: [test]
@@ -76,15 +77,16 @@ jobs:
7677
steps:
7778
- uses: actions/checkout@v4
7879

79-
- uses: actions/setup-python@v4
80+
- uses: actions/setup-python@v5
8081
with:
8182
python-version: '3.8'
8283

8384
- name: Get coverage files
84-
uses: actions/download-artifact@v3
85+
uses: actions/download-artifact@v4
8586
with:
86-
name: coverage
87+
pattern: .coverage*
8788
path: coverage
89+
merge-multiple: true
8890

8991
- run: pip install coverage[toml]
9092

@@ -94,7 +96,7 @@ jobs:
9496
- run: coverage html --show-contexts --title "taskiq-faststream coverage for ${{ github.sha }}"
9597

9698
- name: Store coverage html
97-
uses: actions/upload-artifact@v3
99+
uses: actions/upload-artifact@v4
98100
with:
99101
name: coverage-html
100102
path: htmlcov

pyproject.toml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.9",
2626
"Programming Language :: Python :: 3.10",
2727
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
2829
"Operating System :: OS Independent",
2930
"Topic :: Software Development :: Libraries :: Python Modules",
3031
"Topic :: Software Development :: Libraries",
@@ -42,7 +43,7 @@ dynamic = ["version"]
4243

4344
dependencies = [
4445
"taskiq>=0.10.0,<1.0.0",
45-
"faststream>=0.2.12,<1.0.0",
46+
"faststream>=0.3.0,<1.0.0",
4647
]
4748

4849
[project.optional-dependencies]
@@ -58,25 +59,27 @@ kafka = [
5859
"faststream[kafka]"
5960
]
6061

62+
redis = [
63+
"faststream[redis]"
64+
]
65+
6166
# local dev
6267
test = [
6368
"taskiq-faststream[nats]",
6469
"taskiq-faststream[rabbit]",
6570
"taskiq-faststream[kafka]",
71+
"taskiq-faststream[redis]",
6672

6773
"coverage[toml]>=7.2.0,<8.0.0",
68-
"pytest==7.4.3",
74+
"pytest>=7.4.0,<8",
6975
]
7076

7177
dev = [
7278
"taskiq-faststream[test]",
7379

74-
"mypy==1.7.1",
75-
"black==23.11.0",
76-
"isort==5.12.0",
77-
"ruff==0.1.6",
78-
"pyupgrade-directories==0.3.0",
79-
"pre-commit==3.5.0",
80+
"mypy>=1.8.0,<1.9.0",
81+
"ruff==0.1.11",
82+
"pre-commit >=3.6.0,<4.0.0",
8083
]
8184

8285
[project.urls]
@@ -139,6 +142,8 @@ select = [
139142
"ISC", # Implicit string concat
140143
"PIE", # Unnecessary code
141144
"T20", # Catch prints
145+
"UP", # pyupgrade
146+
"PERF",# perfomance checks
142147
"PYI", # validate pyi files
143148
"Q", # Checks for quotes
144149
"RSE", # Checks raise statements
@@ -162,6 +167,8 @@ ignore = [
162167
"ANN401", # typing.Any are disallowed in `**kwargs
163168
"PLR0913", # Too many arguments for function call
164169
"D106", # Missing docstring in public nested class
170+
"COM812",
171+
"ISC001",
165172
]
166173
exclude = [".venv/"]
167174

@@ -211,8 +218,7 @@ omit = [
211218
[tool.coverage.report]
212219
show_missing = true
213220
skip_empty = true
214-
exclude_lines = [
215-
".*# pragma: no cover",
221+
exclude_also = [
216222
"if __name__ == .__main__.:",
217223
"self.logger",
218224
"def __repr__",

scripts/lint.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
#!/bin/bash
22

3-
echo "Running pyup_dirs..."
4-
pyup_dirs --py38-plus --recursive taskiq_faststream tests
5-
63
echo "Running ruff..."
74
ruff taskiq_faststream tests --fix
85

9-
echo "Running black..."
10-
black taskiq_faststream tests
6+
echo "Running ruff formatter..."
7+
ruff format taskiq_faststream tests
118

129
echo "Running mypy..."
1310
mypy taskiq_faststream

taskiq_faststream/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""FastStream - taskiq integration to schedule FastStream tasks."""
2-
__version__ = "0.1.5"
2+
__version__ = "0.1.6"

tests/test_redis.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import pytest
2+
from faststream import FastStream
3+
from faststream.redis import RedisBroker, TestRedisBroker
4+
from taskiq import AsyncBroker
5+
6+
from taskiq_faststream import AppWrapper
7+
8+
from .testcase import SchedulerTestcase
9+
10+
11+
@pytest.fixture
12+
def broker() -> RedisBroker:
13+
return RedisBroker()
14+
15+
16+
class TestBroker(SchedulerTestcase):
17+
test_class = TestRedisBroker
18+
subj_name = "channel"
19+
20+
21+
class TestApp(TestBroker):
22+
@staticmethod
23+
def build_taskiq_broker(broker: RedisBroker) -> AsyncBroker:
24+
"""Build AppWrapper."""
25+
return AppWrapper(FastStream(broker))

0 commit comments

Comments
 (0)