Skip to content

Add partial type stubs for dependency-safe modules - #163

Open
heejaechang wants to merge 1 commit into
dbcli:mainfrom
heejaechang:heejaechang-add-complete-bundled-stubs
Open

Add partial type stubs for dependency-safe modules#163
heejaechang wants to merge 1 commit into
dbcli:mainfrom
heejaechang:heejaechang-add-complete-bundled-stubs

Conversation

@heejaechang

Copy link
Copy Markdown

Summary

  • ship an empty py.typed marker and complete sidecar stubs for pgspecial.namedqueries and pgspecial.help.commands
  • model named-query configuration structurally so ConfigObj and compatible mutable test configurations retain the required mutation and persistence behavior without Any
  • leave the remaining modules unstubbed rather than weaken their contracts: dbcommands and iocommands cross psycopg Query/Params/cursor/adaptation boundaries; main needs exact decorator/handler correlation; root __init__ aggregates that unresolved surface; help.__init__ is empty and adds no useful typing surface

Type completeness

Exact installed-wheel, unfiltered pyright --verifytypes pgspecial --outputjson (no --ignoreexternal):

Exports Known Ambiguous Unknown Completeness
main baseline 102 15 10 77 14.7059%
This PR 102 23 9 70 22.5490%

The export-name set is unchanged. helpcommands, NamedQueries, and all seven exported NamedQueries methods move to known types.

Validation

  • exact public-name and method surface comparison for both touched modules; focused runtime checks cover factory behavior, mutable named-query state, status strings, and the 166-entry help-table schema
  • strict Pyright and mypy positive consumers pass; malformed configurations, singleton assignments, method arguments, and help-table values fail in both checkers
  • unflagged mypy.stubtest passes for both touched modules on Python 3.9, 3.12, 3.13, and 3.14; whole-package stubtest remains blocked by the intentionally unstubbed main.py source (default_commands lacks an annotation)
  • tox test/coverage environments pass on locally available Python 3.9, 3.12, 3.13, and 3.14
  • Python 3.15-dev reproduces clean-main's external libpq failure: no psycopg C/binary wrapper and no system libpq
  • Ruff remains exactly at the clean-main 93-error baseline; the new artifacts have no lint or format diagnostics
  • wheel built strictly from a fresh sdist; wheel and sdist contain exactly the two .pyi files plus the empty marker, their hashes match the source files, and twine check passes
  • policy scan finds no Any, casts, ignores, suppressions, allowlists, checker disables, or runtime .py changes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

1 participant