Skip to content
Merged
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
12 changes: 0 additions & 12 deletions .coveragerc

This file was deleted.

51 changes: 23 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ env:
jobs:

Test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- python-version: '3.7'
- python-version: '3.8'
- python-version: '3.9'
- python-version: '3.10'
- python-version: '3.11'
- python-version: '3.12'
- python-version: '3.12'
- python-version: '3.13'
- python-version: '3.13'
install-extra: '[sentry]'
services:
redis:
Expand All @@ -37,50 +36,46 @@ jobs:
REDIS_URL: 'redis://localhost:6379/0'
SENTRY_DSN: 'http://user:pass@localhost:12340/foo'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
- name: 'Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v4
uses: astral-sh/setup-uv@v6
with:
python-version: '${{ matrix.python-version }}'
- run: 'pip install -e ".$EXTRA" -e ".[test]"'
activate-environment: true
- run: 'uv pip install -e ".$EXTRA"'
env:
EXTRA: '${{ matrix.install-extra }}'
- run: py.test -vvv --cov .
- uses: codecov/codecov-action@v3
- run: uv run pytest -vvv --cov .
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: 'Python ${{ matrix.python-version }}'

Lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v5
- uses: akx/pre-commit-uv-action@v0.1.0

Mypy:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
- run: pip install -e .[sentry] mypy==1.0.0 types-redis
- run: mypy --strict --install-types --non-interactive --show-error-codes minique
python-version: '3.13'
- run: uv run --all-extras mypy --strict --install-types --non-interactive --show-error-codes minique

Build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [ Lint, Mypy, Test ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
- run: pip install build twine
- run: python -m build .
- run: twine check dist/*
python-version: '3.13'
- run: uv build
- run: uvx twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: build
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ ci:
autofix_prs: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
hooks:
- id: ruff
- id: ruff-check
args:
- --fix
- id: ruff-format
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# minique /miniːk/

A minimal Redis 4.0+ job queue for Python 3.7 and above.
A minimal Redis 4.0+ job queue for Python 3.9 and above.

## Requirements

* Python 3.7+
* Python 3.9+
* Redis 4.0+

## Usage
Expand Down
3 changes: 1 addition & 2 deletions minique/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def main(argv: Optional[List[str]] = None) -> None:
except Exception as exc:
worker.log.warning("Failed to initialize Sentry: %s", exc, exc_info=True)
else:
hub = sentry_sdk.hub.Hub.current
if hub and hub.client and hub.client.dsn:
if (client := sentry_sdk.get_client()) and client.is_active():
worker.log.info("Sentry configured with a valid DSN")

if args.single_tick:
Expand Down
2 changes: 1 addition & 1 deletion minique/work/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def process_exception(
:param excinfo: Optionally, the sys.exc_info() 3-tuple
"""
if sentry_sdk:
with sentry_sdk.push_scope() as scope:
with sentry_sdk.new_scope() as scope:
if context:
scope.set_context("minique", context)
sentry_sdk.capture_exception(excinfo)
4 changes: 2 additions & 2 deletions minique_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ def sentry_event_calls(monkeypatch) -> Optional[list]:
return None
client = sentry_sdk.Client(dsn="http://a:a@example.com/123")
client.capture_event = Mock()
# TODO: this doesn't clean up the hub – maybe we don't need to?
sentry_sdk.Hub.current.bind_client(client)
# TODO: this doesn't clean up the global scope – maybe we don't need to?
sentry_sdk.get_global_scope().set_client(client)
return client.capture_event.call_args_list
4 changes: 0 additions & 4 deletions mypy.ini

This file was deleted.

31 changes: 24 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dynamic = ["version"]
description = "Minimal Redis job runner"
readme = "README.md"
license = "MIT"
requires-python = ">=3.7"
requires-python = ">=3.9"
authors = [
{ name = "Valohai", email = "hait@valohai.com" },
]
Expand All @@ -18,11 +18,7 @@ dependencies = [

[project.optional-dependencies]
sentry = [
"sentry_sdk~=1.10",
]
test = [
"pytest-cov",
"pytest>=6",
"sentry-sdk~=2.36",
]

[project.scripts]
Expand Down Expand Up @@ -53,7 +49,6 @@ filterwarnings = [
]

[tool.ruff]
target-version = "py37"
line-length = 88

[tool.ruff.lint]
Expand All @@ -74,3 +69,25 @@ select = [

[tool.ruff.lint.per-file-ignores]
"minique_tests/**" = ["T2"]

[dependency-groups]
dev = [
"mypy>=1.4.1",
"pytest>=7.4.4",
"pytest-cov>=4.1.0",
"types-redis>=4.6.0.11",
]

[tool.coverage.run]
branch = true
omit = [
"*site-packages*",
]

[tool.coverage.report]
exclude_also = [
"except ImportError:",
"if TYPE_CHECKING:",
"pragma: no cover",
"raise NotImplementedError",
]