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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ permissions: {}
jobs:
backend:
name: Backend
uses: CtrlAltDevelop/ci-workflows/.github/workflows/python-backend.yml@v1.1.1
uses: CtrlAltDevelop/ci-workflows/.github/workflows/python-backend.yml@v1.2.0
permissions:
contents: read
with:
python-version: "3.14"
python-version: "3.15"
# Exported from uv.lock by `make requirements`; keep the two in step.
requirements: requirements.txt
# The suite needs Postgres (triggers, row locks, real concurrency) but
Expand All @@ -31,7 +31,7 @@ jobs:

security:
name: Security
uses: CtrlAltDevelop/ci-workflows/.github/workflows/security.yml@v1.1.1
uses: CtrlAltDevelop/ci-workflows/.github/workflows/security.yml@v1.2.0
permissions:
contents: read
security-events: write
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
- uses: actions/checkout@v7
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: landing
- id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.2] - 2026-12-03

### Changed

- Requires Python 3.15; CI, ruff and mypy target 3.15.
- Dependencies updated: gunicorn 27.0.1 (was 26.2.0), pydantic 2.14.4 with
pydantic-core 2.50.5, psycopg 3.3.9, redis 8.2.0, plus dev tools (ruff,
hypothesis, mypy-extensions).
- CI uses `ci-workflows` v1.2.0 and runs only on pull requests to `main`; the
Pages workflow uses the current `actions/*` majors.

No change to the API or its schema.

## [0.2.1] - 2026-11-30

### Added
Expand Down Expand Up @@ -84,7 +97,8 @@ No change to the service, its API or its schema.
- Docker image, `docker compose` stack, k6 benchmark, and CI through the
shared `ci-workflows` pipelines.

[Unreleased]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.1...HEAD
[Unreleased]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.2...HEAD
[0.2.2]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/CtrlAltDevelop/ledger-service/compare/v0.1.0...v0.1.1
Expand Down
2 changes: 1 addition & 1 deletion ledger/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

api = NinjaAPI(
title="Ledger Service",
version="0.2.1",
version="0.2.2",
description="A double-entry ledger over HTTP.",
auth=ClientBearer(),
urls_namespace="ledger",
Expand Down
8 changes: 4 additions & 4 deletions ledger/api/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def _unpack(cursor: str) -> Any:
try:
padded = cursor + "=" * (-len(cursor) % 4)
return json.loads(base64.urlsafe_b64decode(padded))["before"]
except (binascii.Error, ValueError, KeyError, TypeError):
except binascii.Error, ValueError, KeyError, TypeError:
raise errors.InvalidCursor("cursor is malformed") from None


def page_newest_first(
rows: "QuerySet[M]", cursor: str | None, limit: int
def page_newest_first[M: Model](
rows: QuerySet[M], cursor: str | None, limit: int
) -> tuple[list[M], str | None]:
"""One page of ``rows`` ordered by (created_at, id) descending, plus the next cursor.

Expand All @@ -67,7 +67,7 @@ def _decode_stamp(cursor: str) -> tuple[datetime, UUID]:
value = _unpack(cursor)
try:
stamp, last_id = datetime.fromisoformat(value[0]), UUID(value[1])
except (ValueError, TypeError, IndexError, KeyError, AttributeError):
except ValueError, TypeError, IndexError, KeyError, AttributeError:
raise errors.InvalidCursor("cursor is malformed") from None
if stamp.tzinfo is None:
raise errors.InvalidCursor("cursor is malformed")
Expand Down
2 changes: 1 addition & 1 deletion ledger/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class CaptureIn(Schema):


class HoldPage(Schema):
items: list["HoldOut"]
items: list[HoldOut]
next_cursor: str | None = Field(description="Pass as ?cursor= for the next page.")


Expand Down
4 changes: 1 addition & 3 deletions ledger/services/holds.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ def release_hold(*, client: ApiClient, hold_id: UUID) -> Hold:
return hold


def list_holds(
client: ApiClient, *, account_id: UUID | None, status: str | None
) -> "QuerySet[Hold]":
def list_holds(client: ApiClient, *, account_id: UUID | None, status: str | None) -> QuerySet[Hold]:
"""The client's holds. ``status`` is the effective one, so ``expired`` includes overdue."""
rows = Hold.objects.filter(account__client=client).select_related("account__currency")
if account_id is not None:
Expand Down
2 changes: 1 addition & 1 deletion ledger/services/outbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def publish(self, event: OutboxEvent) -> None:
class RedisStreamPublisher:
"""Appends each event to a Redis stream (``XADD``)."""

def __init__(self, redis_client: "Redis", stream: str) -> None:
def __init__(self, redis_client: Redis, stream: str) -> None:
self._redis = redis_client
self._stream = stream

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[project]
name = "ledger-service"
version = "0.2.1"
version = "0.2.2"
description = "A double-entry ledger over HTTP: atomic, idempotent, append-only."
readme = "README.md"
license = "AGPL-3.0-only"
license-files = ["LICENSE"]
authors = [{ name = "Mohammad Zarif" }]
requires-python = ">=3.12"
requires-python = ">=3.15"
dependencies = [
"django>=5.2,<6.2",
"django-ninja>=1.4",
Expand All @@ -33,7 +33,7 @@ dev = [
package = false

[tool.ruff]
target-version = "py312"
target-version = "py315"
line-length = 100
extend-exclude = ["ledger/migrations"]

Expand All @@ -54,7 +54,7 @@ ignore = [
known-first-party = ["config", "ledger"]

[tool.mypy]
python_version = "3.12"
python_version = "3.15"
strict = true
plugins = ["mypy_django_plugin.main"]
exclude = ["^\\.venv/", "^bench/"]
Expand Down
Loading