Skip to content

Migrate from mypy to pyright and clean up type annotations#895

Draft
MaxDall wants to merge 3 commits intomasterfrom
use-pyright
Draft

Migrate from mypy to pyright and clean up type annotations#895
MaxDall wants to merge 3 commits intomasterfrom
use-pyright

Conversation

@MaxDall
Copy link
Copy Markdown
Collaborator

@MaxDall MaxDall commented Mar 16, 2026

Replaced mypy with pyright for type checking. While migrating, we stumbled across a handful of actual bugs and misconceptions hiding behind # type: ignore comments — so we fixed those instead of carrying them over.

Notable fixes along the way:

  • Overload signatures in base_parser.py, regex.py, and parser/data.py were tightened
  • JSONFile and its subclass dropped @dataclass in favor of explicit __init__, resolving a field type invariance issue cleanly
  • Omit unnecessarily joining the pool in the CCNewsCrawler

Almost all # type: ignore comments are gone. The two that remain are intentional: one suppresses a third-party stubs incompatibility (warcio/urllib3), the other marks an intentionally invalid API call in a test.

Update: Maybe heading for ty [1] right away is the better choice here.

@MaxDall MaxDall changed the title Use pyright Migrate from mypy to pyright and clean up type annotations Mar 16, 2026
@MaxDall MaxDall requested a review from addie9800 March 16, 2026 17:54
@MaxDall MaxDall marked this pull request as draft March 16, 2026 17:54
@MaxDall MaxDall added the proposal You want to address a specific problem? Let us know about your idea. label Apr 8, 2026
Base automatically changed from use-ruff to master April 20, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proposal You want to address a specific problem? Let us know about your idea.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant