Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v5
with:
python-version: "3.11"
- name: Install deps
run: poetry install
- name: Set version
run: poetry version "${{ github.ref_name }}"
- name: Release package
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build
persist-credentials: false
- uses: astral-sh/setup-uv@v7
with:
enable-cache: false
python-version: "3.12"
version: "latest"
- run: uv version "${GITHUB_REF_NAME}"
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command uv version "${GITHUB_REF_NAME}" appears to be incorrect. The uv CLI doesn't have a version subcommand that sets the project version. You likely need a different approach to set the version in the project, such as modifying the pyproject.toml file directly or using a tool that supports version management. Consider using sed or a similar tool to update the version in pyproject.toml.

Suggested change
- run: uv version "${GITHUB_REF_NAME}"
- run: sed -i 's/^version = .*/version = "'"${GITHUB_REF_NAME}"'"/' pyproject.toml

Copilot uses AI. Check for mistakes.
- run: uv build
- run: uv publish --trusted-publishing always
66 changes: 36 additions & 30 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,67 @@
name: Testing taskiq-nats

on: pull_request
on:
pull_request:
paths-ignore:
- '*.md'

permissions:
actions: read
contents: read
pull-requests: read

jobs:
lint:
strategy:
matrix:
cmd:
- black
- ruff
- mypy
cmd: ["black", "ruff", "mypy"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v5
with:
persist-credentials: false
- id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
cache: "poetry"
enable-cache: true
cache-suffix: 3.11
version: "latest"
python-version: 3.11
- name: Install deps
run: poetry install
run: uv sync --all-extras
- name: Run lint check
run: poetry run pre-commit run -a ${{ matrix.cmd }}
run: uv run pre-commit run -a ${{ matrix.cmd }}
pytest:
strategy:
matrix:
py_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
py_version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v5
with:
persist-credentials: false
- id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: "${{ matrix.py_version }}"
- name: Update pip
run: python -m pip install -U pip
- name: Install poetry
run: python -m pip install poetry
enable-cache: true
cache-suffix: ${{ matrix.py_version }}
version: "latest"
python-version: ${{ matrix.py_version }}
- name: Install deps
run: poetry install
env:
POETRY_VIRTUALENVS_CREATE: false
run: uv sync --all-extras
- name: Update docker-compose
uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: "2.16.0"
- name: docker compose up
run: docker-compose up -d --wait
- name: Run pytest check
run: poetry run pytest -vv -n auto --cov="taskiq_nats" .
run: uv run pytest -vv -n auto --cov="taskiq_nats" .
- name: Generate report
run: poetry run coverage xml
run: uv run coverage xml
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
if: matrix.py_version == '3.9'
uses: codecov/codecov-action@v5
if: matrix.py_version == '3.10'
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
Expand Down
81 changes: 48 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,55 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: check-toml
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: check-toml
- id: end-of-file-fixer

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.1.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma

- repo: local
hooks:
- id: black
name: Format with Black
entry: poetry run black
language: system
types: [ python ]
- repo: https://github.com/crate-ci/typos
rev: v1.38.1
hooks:
- id: typos

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.0
hooks:
- id: ruff
name: ruff-check
pass_filenames: false
args:
- --fix
- taskiq_nats
- tests
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
pass_filenames: false
- repo: local
hooks:
- id: black
name: Format with Black
entry: uv run black
language: system
types: [python]

- id: ruff
name: Run ruff lints
entry: uv run ruff
language: system
pass_filenames: false
types: [python]
args:
- "check"
- "--fix"
- "taskiq_nats"
- "tests"

- id: mypy
name: Validate types with MyPy
entry: uv run mypy
language: system
pass_filenames: false
types: [python]
args:
- ./taskiq_nats
- ./tests
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2025 Taskiq team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Taskiq NATS

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/taskiq-nats?style=for-the-badge)](https://pypi.org/project/taskiq-nats/)
[![PyPI](https://img.shields.io/pypi/v/taskiq-nats?style=for-the-badge)](https://pypi.org/project/taskiq-nats/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/taskiq-nats?style=for-the-badge)](https://pypistats.org/packages/taskiq-nats)

Taskiq-nats is a plugin for taskiq that adds NATS broker.
This package has support for NATS JetStream.

Expand Down Expand Up @@ -94,7 +98,7 @@ if __name__ == "__main__":
Here's the constructor parameters:

* `servers` - a single string or a list of strings with nats nodes addresses.
* `subject` - name of the subect that will be used to exchange tasks betwee workers and clients.
* `subject` - name of the subect that will be used to exchange tasks between workers and clients.
* `queue` - optional name of the queue. By default NatsBroker broadcasts task to all workers,
but if you want to handle every task only once, you need to supply this argument.
* `result_backend` - custom result backend.
Expand All @@ -104,7 +108,7 @@ Here's the constructor parameters:
## JetStreamBroker configuration
### Common
* `servers` - a single string or a list of strings with nats nodes addresses.
* `subject` - name of the subect that will be used to exchange tasks betwee workers and clients.
* `subject` - name of the subect that will be used to exchange tasks between workers and clients.
* `stream_name` - name of the stream where subjects will be located.
* `queue` - a single string or a list of strings with nats nodes addresses.
* `result_backend` - custom result backend.
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.7'

# This docker compose is used for testing.
# It contains only services required for pytest to run
# successfully.
Expand Down
Loading
Loading