Skip to content

Commit afa6fda

Browse files
committed
bump dependencies and update authors
1 parent 1e30667 commit afa6fda

8 files changed

Lines changed: 371 additions & 127 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: ci
2+
3+
on: pull_request
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref }}
7+
cancel-in-progress: true
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-python@v6
20+
with:
21+
python-version-file: ".python-version"
22+
- uses: pre-commit/action@v3.0.1
23+
24+
typecheck:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v6
28+
with:
29+
persist-credentials: false
30+
- uses: actions/setup-python@v6
31+
with:
32+
python-version-file: ".python-version"
33+
- uses: astral-sh/setup-uv@v7
34+
- run: uv sync --locked
35+
- run: uv run mypy celerymon/
36+
37+
zizmor:
38+
runs-on: ubuntu-latest
39+
permissions:
40+
security-events: write
41+
steps:
42+
- uses: actions/checkout@v6
43+
with:
44+
persist-credentials: false
45+
- uses: zizmorcore/zizmor-action@v0.5.2

.github/workflows/image-build.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ jobs:
1616
contents: read
1717
packages: write
1818
steps:
19-
- uses: actions/checkout@v4
20-
- uses: docker/login-action@v3
19+
- uses: actions/checkout@v6
20+
with:
21+
persist-credentials: false
22+
- uses: docker/login-action@v4
2123
with:
2224
registry: ${{ env.REGISTRY }}
2325
username: ${{ github.actor }}
2426
password: ${{ secrets.GITHUB_TOKEN }}
2527
- id: meta
26-
uses: docker/metadata-action@v5
28+
uses: docker/metadata-action@v6
2729
with:
2830
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
29-
- uses: docker/build-push-action@v5
31+
- uses: docker/build-push-action@v7
3032
with:
3133
context: .
3234
push: true

.github/zizmor.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
actions/*: ref-pin
6+
docker/*: ref-pin
7+
pre-commit/action: ref-pin
8+
astral-sh/setup-uv: ref-pin
9+
zizmorcore/zizmor-action: ref-pin

celerymon/event_watcher.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from collections import OrderedDict, defaultdict
99
from typing import Any, Sequence
1010

11-
import celery # type: ignore[import]
11+
import celery
1212

1313
from .timer import RepeatTimer
1414

@@ -40,7 +40,7 @@ def run() -> None:
4040
while True:
4141
try:
4242
with app.connection() as conn:
43-
recv = app.events.Receiver(conn, handlers={"*": store.on_event}) # type: ignore[attr-defined]
43+
recv = app.events.Receiver(conn, handlers={"*": store.on_event})
4444
logger.info("EventWatcher connected, capturing events")
4545
backoff = 1.0
4646
recv.capture(limit=None)
@@ -59,7 +59,9 @@ def update_enable_event() -> None:
5959
timer.daemon = True
6060
timer.start()
6161

62-
thread = threading.Thread(target=run, daemon=True, name="celerymon-event-watcher")
62+
thread = threading.Thread(
63+
target=run, daemon=True, name="celerymon-event-watcher"
64+
)
6365
thread.start()
6466

6567
return store

celerymon/redis_watcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ def _format_key(self, queue_name: str, priority: int) -> str:
6060
"""
6161
if not priority:
6262
return queue_name
63-
return "{0}{1}{2}".format(queue_name, PRIORITY_SEP, priority)
63+
return "{}{}{}".format(queue_name, PRIORITY_SEP, priority)

celerymon/worker_watcher.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ def _update(self) -> None:
3939
oldest_timestamp: dict[str, datetime.datetime] = dict()
4040
task_count: dict[tuple[str, str], int] = defaultdict(int)
4141

42-
# active(), reserved() and scheduled() have wrong type annotations.
43-
for tasks in (self._inspect.active() or {}).values(): # type: ignore[union-attr]
42+
for tasks in (self._inspect.active() or {}).values():
4443
for task in tasks:
4544
if isinstance(task["time_start"], str):
4645
start_time = datetime.datetime.fromisoformat(task["time_start"])
@@ -54,10 +53,10 @@ def _update(self) -> None:
5453
oldest_timestamp[task_name] = min(
5554
oldest_timestamp[task_name], start_time
5655
)
57-
for tasks in (self._inspect.reserved() or {}).values(): # type: ignore[union-attr]
56+
for tasks in (self._inspect.reserved() or {}).values():
5857
for task in tasks:
5958
task_count[("reserved", task["type"])] += 1
60-
for scheduled_tasks in (self._inspect.scheduled() or {}).values(): # type: ignore[union-attr]
59+
for scheduled_tasks in (self._inspect.scheduled() or {}).values():
6160
for scheduled_task in scheduled_tasks:
6261
task_count[("scheduled", scheduled_task["request"]["type"])] += 1
6362

pyproject.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
name = "celerymon"
33
version = "0.1.3"
44
description = ""
5-
authors = [{ name = "Masaya Suzuki", email = "masaya@aviator.co" }]
6-
dependencies = ["celery[redis]>=5.4.0", "prometheus-client>=0.21.0"]
5+
authors = [
6+
{ name = "Masaya Suzuki", email = "masaya@aviator.co" },
7+
{ name = "Ofer Goldstein", email = "ofer@aviator.co" },
8+
]
9+
dependencies = [
10+
"celery[redis]>=5.6.3",
11+
"prometheus-client>=0.24.1",
12+
]
713
readme = "README.md"
814
license = "MIT"
915
requires-python = ">= 3.13"
@@ -12,7 +18,12 @@ requires-python = ">= 3.13"
1218
celerymon = 'celerymon.cli:run'
1319

1420
[dependency-groups]
15-
dev = ["celery-types>=0.22.0", "pyright", "types-redis>=4.6.0.6"]
21+
dev = [
22+
"celery-types>=0.26.0",
23+
"mypy>=1.20.0",
24+
"pyright>=1.1.408",
25+
"types-redis>=4.6.0.6",
26+
]
1627

1728
[build-system]
1829
requires = ["hatchling"]

0 commit comments

Comments
 (0)