Skip to content

[peewee] Add stubs for playhouse extension modules - #16878

Merged
srittau merged 5 commits into
python:mainfrom
klen:playhouse-extension-stubs
Nov 23, 2026
Merged

srittau merged 5 commits into
python:mainfrom
klen:playhouse-extension-stubs

Conversation

@klen

@klen klen commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

The peewee stubs are a partial stub, but playhouse.sqlite_ext, playhouse.postgres_ext and playhouse.test_utils are commonly used and currently resolve to Any (or fail as untyped calls under stricter checkers). This adds stubs for sqlite_ext.JSONField, postgres_ext.ArrayField and test_utils.count_queries, matching the runtime implementations.

Upstream: https://github.com/coleifer/peewee/blob/master/playhouse/sqlite_ext.py, https://github.com/coleifer/peewee/blob/master/playhouse/postgres_ext.py, https://github.com/coleifer/peewee/blob/master/playhouse/test_utils.py

Written with pi.

klen and others added 3 commits November 20, 2026 15:05
Cover playhouse.sqlite_ext.JSONField, playhouse.postgres_ext.ArrayField
and playhouse.test_utils.count_queries, which were missing from the
partial stubs. 🖇
The new playhouse extension stubs only cover a few names, so allowlist
the rest and type the JSONField json_dumps/json_loads arguments. 🎂
@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a full review, just a few things I noticed.

Comment thread stubs/peewee/playhouse/postgres_ext.pyi Resolved
Comment thread stubs/peewee/playhouse/postgres_ext.pyi Resolved
klen added 2 commits November 23, 2026 11:40
Make ArrayField generic over its item type and document the Any arguments
that are forwarded to the parent constructors. ◀️
object would reject typed json_dumps callbacks such as a dict-only
serializer, and db_value accepts nodes as well as JSON values. 🦈
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 5b7a6f6 into python:main Nov 23, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants