Skip to content

Add type stubs for Brython browser module imports#45

Merged
vl3c merged 3 commits intomainfrom
feature/brython-browser-typing-stubs-v13
Feb 18, 2026
Merged

Add type stubs for Brython browser module imports#45
vl3c merged 3 commits intomainfrom
feature/brython-browser-typing-stubs-v13

Conversation

@vl3c
Copy link
Copy Markdown
Owner

@vl3c vl3c commented Feb 17, 2026

Summary

  • Add .pyi type stubs for the Brython browser package (__init__.pyi, _dom.pyi, ajax.pyi, aio.pyi) under static/client/typing/browser/
  • Cover all from browser import X names used in client-side Python code
  • Fix pre-existing mypy issues in canvas2d_primitive_adapter.py exposed by the new stubs
  • Add comprehensive tests in test_browser_typing_stubs.py
  • Wide-ranging type annotation improvements across 337 files (AI-assisted cleanup)

Test results

  • 1065 tests passed, 0 failures, 26 skipped
  • Mypy errors: 576 on this branch vs 647 on main (net improvement)
  • Lint check failed on pre-existing mypy issues unrelated to the stubs

Notes

Generated by SelfAssembler v13 run through Claw2PR Docker pipeline. The workflow completed research, planning, implementation, test_writing, test_execution (all green), and code_review phases successfully. Lint check oscillated on pre-existing mypy errors in the broader codebase.

vl3c added 3 commits February 17, 2026 20:38
Add .pyi stubs for the browser package (browser/__init__.pyi, browser/ajax.pyi,
browser/aio.pyi) covering all from-browser imports used in client-side Python.
Fix pre-existing mypy issues in canvas2d_primitive_adapter.py exposed by the
new stubs. Update tests in test_browser_typing_stubs.py.

All 1065 tests pass (0 failures). Mypy errors in the changed files are
pre-existing (647 errors on main, 576 on this branch — net improvement).
- Add missing DOMNode properties (id, src, outerHTML) and methods
  (replaceChild, setSelectionRange) to _dom.pyi
- Make DOMNode.select() parameter optional for input text selection
- Widen Window.setTimeout delay type to accept float
- Add explicit type annotation for SvgRenderer._offscreen_surface
- Use intermediate typed variables to avoid no-any-return in
  DrawableManager and TransformationsManager
- Add type: ignore comments for intentional monkey-patching in tests
- Replace os.getuid() with getattr fallback for Windows compatibility
@vl3c vl3c merged commit b8fc86b into main Feb 18, 2026
1 check failed
@vl3c vl3c deleted the feature/brython-browser-typing-stubs-v13 branch February 18, 2026 20:45
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