Skip to content

Commit

Permalink
Update various libraries (#15)
Browse files Browse the repository at this point in the history
* Update to Python 3.13
* Update pre-commit hooks
* Update libraries
* Use pyright instead of mypy
* Use pyupgrade
* Restore the default linter rules
* Replace deprecated usages with the new ones
  • Loading branch information
draftcode authored Jan 2, 2025
1 parent 28a352d commit b0070d3
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 94 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
rev: v0.8.4
hooks:
- id: ruff
args: [ --fix ]
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.3
3.13.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
Expand Down
8 changes: 4 additions & 4 deletions celerymon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def __init__(self):
self.event_last_updated = None

def redis_updated(self):
self.redis_last_updated = datetime.datetime.utcnow()
self.redis_last_updated = datetime.datetime.now(datetime.UTC)

def worker_inspect_updated(self):
self.worker_inspect_last_updated = datetime.datetime.utcnow()
self.worker_inspect_last_updated = datetime.datetime.now(datetime.UTC)

def event_updated(self):
self.event_last_updated = datetime.datetime.utcnow()
self.event_last_updated = datetime.datetime.now(datetime.UTC)


def format_key(queue_name: str, priority: int) -> str:
Expand All @@ -54,7 +54,7 @@ def format_key(queue_name: str, priority: int) -> str:
"""
if not priority:
return queue_name
return "{0}{1}{2}".format(queue_name, PRIORITY_SEP, priority)
return "{}{}{}".format(queue_name, PRIORITY_SEP, priority)


def start_celerymon_redis_watcher(
Expand Down
Empty file added celerymon/py.typed
Empty file.
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ authors = [{ name = "Masaya Suzuki", email = "[email protected]" }]
dependencies = ["celery[redis]>=5.4.0", "prometheus-client>=0.21.0"]
readme = "README.md"
license = "MIT"
requires-python = ">= 3.12"
requires-python = ">= 3.13"

[project.scripts]
celerymon = 'celerymon.cli:run'

[dependency-groups]
dev = [
"celery-types>=0.22.0",
"mypy>=1.5.1",
"types-redis>=4.6.0.6",
]
dev = ["celery-types>=0.22.0", "pyright", "types-redis>=4.6.0.6"]

[build-system]
requires = ["hatchling"]
Expand All @@ -30,6 +26,11 @@ packages = ["celerymon"]

[tool.ruff.lint]
select = [
# Default values
"E4",
"E7",
"E9",
"F",
# isort
"I001",
]
Expand Down
141 changes: 61 additions & 80 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit b0070d3

Please sign in to comment.