Skip to content

Add typing annotations and modernize codebase; remove .pyi stubs#193

Merged
Erotemic merged 29 commits intomainfrom
codex/convert-type-annotations-to-inline-format
Mar 1, 2026
Merged

Add typing annotations and modernize codebase; remove .pyi stubs#193
Erotemic merged 29 commits intomainfrom
codex/convert-type-annotations-to-inline-format

Conversation

@Erotemic
Copy link
Owner

Motivation

  • Modernize the codebase for newer Python typing usage and reduce reliance on separate stub files by moving type information into implementation files.
  • Reduce spurious static-type noise by adding project-level ty rules and small runtime fixes to make static checks and runtime behavior more robust.

Description

  • Added from __future__ import annotations and inlined type hints (parameters and return types) across many modules, including __main__.py, constants.py, demo.py, global_state.py, and multiple utils modules.
  • Removed many .pyi stub files and consolidated typing into the implementation files, and added # type: ignore[attr-defined] where necessary in __main__.py to silence false positives.
  • Updated pyproject.toml to include a new [tool.ty.rules] section to ignore a broad set of type-check rules during gradual typing adoption.
  • Made small behavioral and refactor fixes such as renaming local parser to config_parser in __main__.py, improving add_line_numbers and highlight helpers in util_str.py, adding runtime assert checks, and refining async utilities and TempDir typings.

Testing

  • Ran the project's test suite with pytest and all tests completed successfully.
  • Verified basic CLI paths in python -m xdoctest smoke runs and confirmed the --version/--version-info flows exit with expected codes.

Codex Task

@Erotemic
Copy link
Owner Author

Erotemic commented Mar 1, 2026

Codex was having a hard time getting the request right, I manually went through and did the final pass to fix the Any types it added and get to a green dashboard.

@Erotemic Erotemic merged commit 97f8ae7 into main Mar 1, 2026
81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant