Skip to content

Conversation

@MorariMaxim
Copy link
Collaborator

@MorariMaxim MorariMaxim commented Nov 5, 2025

A great type checker, reveals a lot of issues in the codebase

Summary by CodeRabbit

  • Chores
    • Enhanced development tooling by implementing strict type checking configuration in the development pipeline.

Copilot AI review requested due to automatic review settings November 5, 2025 12:41
@coderabbitai
Copy link

coderabbitai bot commented Nov 5, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Type checking tooling configuration is introduced. A new Pyright pre-commit hook is added to the pre-commit configuration targeting the streamerate directory, and Pyright's strict type checking mode is enabled in the project configuration file.

Changes

Cohort / File(s) Summary
Pre-commit hook configuration
\.pre-commit-config.yaml``
Adds new Pyright hook (v1.1.407) restricted to streamerate/ files with project configuration argument
Pyright type checking setup
\pyproject.toml``
Introduces [tool.pyright] section with typeCheckingMode = "strict" for strict static type analysis

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify Pyright version v1.1.407 is appropriate and compatible
  • Confirm strict type checking mode won't cause excessive failures in the existing codebase

Poem

A rabbit hops through code so neat,
With Pyright's gaze, no type's discreet,
Strict checking now, from here to there,
Every function, variable, pair! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add pyright to precommits' directly and clearly summarizes the main change: adding the pyright type checker to the pre-commit hooks configuration.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add_pyright_to_precommits

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61430c1 and 3dec775.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (macos-latest, 3.11)
🔇 Additional comments (3)
pyproject.toml (1)

51-52: Pyright strict mode configuration added correctly.

The new [tool.pyright] section properly enables strict type checking, which aligns with the intent to add comprehensive type validation to the project. This configuration will be enforced by the pre-commit hook added in .pre-commit-config.yaml.

.pre-commit-config.yaml (2)

63-63: Confirm the restrictive file pattern is intentional.

The files: ^streamerate/ pattern excludes test files, configuration files, and other non-source code from type checking. Verify this is intentional—if type checking should also cover test code or other Python files in the repository, consider adjusting the pattern or removing it to check all Python files.

For reference, confirm whether you want type checking to apply only to the streamerate/ directory or if the pattern should be broadened.


59-64: Pyright hook configuration approved—version is current with no security issues.

The hook uses v1.1.407, which is the latest released version, and no known security vulnerabilities have been reported for this version. The configuration correctly invokes Pyright with project settings and appropriately scopes type checking to the main source directory.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive type stub file (.pyi) for the streamerate library to enable static type checking with Pyright in strict mode. It also configures Pyright as a pre-commit hook.

Key changes:

  • Adds complete type stubs for all streamerate classes (stream, slist, sset, sdict, defaultstreamdict) and utility functions
  • Configures Pyright with strict type checking mode in pyproject.toml
  • Adds Pyright pre-commit hook to run type checking on the streamerate package

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
streamerate/__init__.pyi New type stub file providing type hints for all public APIs including stream operations, collections, and utility functions
pyproject.toml Adds Pyright configuration with strict type checking mode
.pre-commit-config.yaml Adds Pyright pre-commit hook at version v1.1.407 to validate types
Comments suppressed due to low confidence (1)

streamerate/init.pyi:1

  • The error message says 'sset' but this is in the sdict.__reversed__ method. The implementation in streams.py line 1756 has the same bug. The error message should say "'sdict' object is not reversible" to correctly identify the class.
# Type stub for streamerate

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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