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
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# runners under the free-tier comfort window.
max-parallel: 3
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
python-version: ["3.11", "3.12", "3.13", "3.14", "3.15"]

steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

# Postgres matrix — pinned PG 16 (LTS-style middle-of-the-road)
# plus the two flanking majors most production users run. Runs
# only on Python 3.14 (Python compat is covered by the SQLite
# only on Python 3.15 (Python compat is covered by the SQLite
# job above).
postgres:
name: PostgreSQL ${{ matrix.postgres-version }}
Expand Down Expand Up @@ -109,8 +109,8 @@ jobs:
with:
version: "latest"

- name: Set up Python 3.14
run: uv python install 3.14
- name: Set up Python 3.15
run: uv python install 3.15

- name: Install dependencies
run: uv sync --extra=all
Expand Down Expand Up @@ -167,8 +167,8 @@ jobs:
with:
version: "latest"

- name: Set up Python 3.14
run: uv python install 3.14
- name: Set up Python 3.15
run: uv python install 3.15

- name: Install dependencies
run: uv sync --extra=all
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
fail-fast: false
max-parallel: 2
matrix:
python-version: ["3.13", "3.14"]
python-version: ["3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
Expand All @@ -227,8 +227,8 @@ jobs:
- uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python 3.14
run: uv python install 3.14
- name: Set up Python 3.15
run: uv python install 3.15
- name: Build djanorm
run: uv build
- name: Build djanorm-mypy
Expand All @@ -254,8 +254,8 @@ jobs:
- uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Set up Python 3.14
run: uv python install 3.14
- name: Set up Python 3.15
run: uv python install 3.15
- name: Build wheel
run: uv build
- name: Install wheel into a fresh venv
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.14.4
3.15.0
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [4.5.0] - 2026-10-12

Minor release. No breaking changes.

### Added

- **Python 3.15 support.** Added the `Programming Language :: Python :: 3.15` trove classifier and extended the CI test matrix (SQLite, DuckDB, Postgres, MySQL, siblings, release smoke) to Python 3.15. The minimum supported version remains 3.11. The classifier is also declared in the `djanorm-mypy` sibling package.

### Changed

- **Dependency floors raised for Python 3.15 wheels** (users on 3.11–3.14 are unaffected — these are the first releases that publish `cp315` / `abi3` wheels):
- `djanorm[postgresql]`: `psycopg[binary,pool]>=3.3.6` (was `>=3.3.3`; `psycopg-binary` first ships a `cp315` wheel at 3.3.6).
- `djanorm[parquet]`: `pyarrow>=26.0` (was `>=14.0`; first release with `cp315` wheels).
- `djanorm[libsql]`: `pyturso>=0.6.0` (was `>=0.5.1`; first release with `cp315` wheels; 0.7+ also ships `abi3`).
- `djanorm[image]` and `djanorm[dev]`: `Pillow>=12.3.0` (was `>=12.2.0` / `>=10.0`; first release with `cp315` manylinux wheels — without one, a 3.15 install falls back to an sdist build that needs system libjpeg headers).
- **Lockfile refreshed to versions that ship `cp315` manylinux wheels** so a Python 3.15 `uv sync --extra=all` installs binaries instead of compiling from source: `numpy` 2.5.x, `pydantic` 2.14 / `pydantic-core` 2.50, `msgspec` 0.22, `markupsafe` 3.0.4, `cffi` 2.1, `pillow` 12.3.
- **Test suite isolation sped up ~2.4×.** The autouse `clean_data` fixture was still calling `_recreate_schema` (DROP + CREATE of all 6 base tables) on the common same-backend path, contradicting its own docstring and doubling work with the DELETE-based teardown. Schema is now created once per session by `schema_manager` and only rows are cleaned between tests. Full suite (SQLite + Postgres parametrisation): ~15.5 min → ~6.5 min locally; the SQLite-only CI leg drops from ~95 s to ~64 s.

## [4.4.0] - 2026-05-26

Minor release. No breaking changes vs 4.3 — every addition is opt-in.
Expand Down
1 change: 1 addition & 0 deletions djanorm-mypy/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Software Development :: Quality Assurance",
"Typing :: Typed",
]
Expand Down
17 changes: 11 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "djanorm"
version = "4.4.0"
version = "4.5.0"
description = "A Django-like ORM with synchronous and asynchronous support"
readme = "README.md"
authors = [{ name = "Ricardo Robles", email = "ricardo.r.f@hotmail.com" }]
Expand All @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Database",
"Framework :: AsyncIO",
"Typing :: Typed",
Expand Down Expand Up @@ -68,7 +69,10 @@ dev = [
# Pillow powers tests for ``dorm.ImageField``. Same opt-in
# rationale as the other extras; production users only install
# ``djanorm[image]`` if they actually use ImageField.
"Pillow>=10.0",
# Floor is 12.3.0 because that's the first release with cp315
# manylinux wheels — without one, a Python 3.15 install falls
# back to an sdist build that needs system libjpeg headers.
"Pillow>=12.3.0",
]
# Standalone group for users who want to wire dorm.contrib.otel — kept
# separate from ``dev`` so production installs don't pull SDK + exporters.
Expand All @@ -81,7 +85,7 @@ otel = [
# aiosqlite.Connection. Untested on 0.23+; bump only after verifying the
# attribute name still exists (and update the runtime warning if not).
sqlite = ["aiosqlite>=0.22.1,<0.23"]
postgresql = ["psycopg[binary,pool]>=3.3.3"]
postgresql = ["psycopg[binary,pool]>=3.3.6"]
# Optional S3 storage backend for ``dorm.FileField`` — see
# ``dorm.contrib.storage.s3``. boto3 picks up credentials from the
# ambient environment (IAM role, ``~/.aws/credentials``, env vars) by
Expand All @@ -90,7 +94,8 @@ s3 = ["boto3>=1.43.1"]
# Pillow powers ``dorm.ImageField`` — used at assignment time to
# verify uploads parse as recognisable images before they hit
# storage. Skip this extra if you only use ``FileField``.
image = ["Pillow>=12.2.0"]
# 12.3.0 is the first release with cp315 manylinux wheels.
image = ["Pillow>=12.3.0"]
# Optional Pydantic v2 interop — needed for dorm.contrib.pydantic.schema_for(),
# which generates FastAPI-friendly request/response schemas from dorm models.
# Email/URL/IP format validation is done by dorm's own field code on
Expand Down Expand Up @@ -132,7 +137,7 @@ vector = ["djanorm[pgvector,sqlite-vec]"]
# fresh connection — the ``vendor == "libsql"`` branch in
# ``VectorField`` picks the right column type and SQL emitter.
libsql = [
"pyturso>=0.5.1",
"pyturso>=0.6.0",
]
# Redis-backed result cache for ``QuerySet.cache(timeout=…)``.
# Sync (``redis.Redis``) and async (``redis.asyncio.Redis``)
Expand Down Expand Up @@ -187,7 +192,7 @@ litestar = ["litestar>=2.10"]
# Parquet dump for ``dorm.contrib.querylog.QueryLog.dump_parquet``.
# Pyarrow is heavy; gate it behind its own extra so a typical
# install doesn't pull a ~40 MB wheel.
parquet = ["pyarrow>=14.0"]
parquet = ["pyarrow>=26.0"]
# CockroachDB backend reuses the PostgreSQL psycopg pipeline.
# This alias makes ``pip install 'djanorm[cockroachdb]'`` work
# without the user having to remember the underlying extra.
Expand Down
20 changes: 16 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ def _shared_minio_endpoint(tmp_path_factory) -> dict:
# silently change the API surface tests rely on. Bump
# deliberately when reviewing changelogs.
minio = MinioContainer(image="minio/minio:RELEASE.2025-04-22T22-12-26Z")
minio.start()
try:
minio.start()
except Exception as exc:
# The pinned image may disappear from Docker Hub (MinIO has
# stopped publishing public images). Skip cleanly so the rest
# of the suite stays green.
pytest.skip(f"MinIO image unavailable, skipping live S3 tests: {exc}")
host = minio.get_container_host_ip()
api_port = int(minio.get_exposed_port(9000))
info = {
Expand Down Expand Up @@ -525,6 +531,9 @@ def clean_data(schema_manager, db_config):

current_db = dict(db_config)
if _active_db_config is not None and current_db != _active_db_config:
# Backend switch (rare — alternative runners that don't isolate
# session fixtures between parametrized variants). Rebuild schema
# on the new backend.
reset_connections()
configure(
DATABASES={"default": current_db},
Expand All @@ -533,16 +542,19 @@ def clean_data(schema_manager, db_config):
_active_db_config = dict(current_db)
_recreate_schema(get_connection())
else:
# Close and reopen connections every test to prevent cumulative
# connection state issues (e.g. SQLite readonly after many tests).
# Common path: same backend. Tables already exist (created once
# by session-scoped ``schema_manager``). Only reset connections
# so no cumulative connection state leaks across tests; the
# teardown below DELETEs rows. Calling ``_recreate_schema`` here
# used to DROP+CREATE all 6 base tables on every test, which
# dominated suite runtime (~100ms x N tests).
reset_connections()
if _active_db_config is None:
_active_db_config = dict(current_db)
configure(
DATABASES={"default": current_db},
INSTALLED_APPS=["tests"],
)
_recreate_schema(get_connection())

from dorm.contrib.contenttypes.models import ContentType
ContentType.objects.clear_cache()
Expand Down
18 changes: 10 additions & 8 deletions tests/test_skip_locked_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,25 @@ def test_skip_locked_two_workers_claim_disjoint_rows(db_config):
)

claimed: dict[str, list[int]] = {"a": [], "b": []}
barrier = threading.Barrier(2)
# Two barriers: one so both workers start together, one so both
# hold their row locks before either commits. Without the second
# barrier the workers can serialise — each then re-claims the same
# first 10 rows (SKIP LOCKED only skips *currently* locked rows),
# so the union is 10 instead of 20.
start_barrier = threading.Barrier(2)
claim_barrier = threading.Barrier(2)

def _worker(name: str) -> None:
# Synchronise both threads at the start so they overlap.
barrier.wait()
start_barrier.wait()
with transaction.atomic():
qs = (
Author.objects.select_for_update(skip_locked=True)
.order_by("pk")[:10]
)
for row in qs:
claimed[name].append(row.pk)
# Hold the transaction long enough that the other
# worker reaches its own SELECT FOR UPDATE before we
# commit; otherwise both workers serialise and one
# claims everything.
# Implicit commit on context-manager exit.
# Hold the locks until the other worker has claimed too.
claim_barrier.wait(timeout=10.0)

t1 = threading.Thread(target=_worker, args=("a",))
t2 = threading.Thread(target=_worker, args=("b",))
Expand Down
Loading
Loading