Skip to content

[codex] Use Pyrefly for type checking#46

Merged
michaelmwu merged 1 commit into
mainfrom
michaelmwu/use-pyrefly-typecheck
Jun 28, 2026
Merged

[codex] Use Pyrefly for type checking#46
michaelmwu merged 1 commit into
mainfrom
michaelmwu/use-pyrefly-typecheck

Conversation

@michaelmwu

Copy link
Copy Markdown
Member

Summary

  • Replace mypy with Pyrefly in dev dependencies and uv.lock.
  • Add explicit strict Pyrefly config for the src package on Python 3.14.
  • Route local type checking, pre-commit, and CI through pyrefly check, including GitHub annotation output in CI.
  • Fix Pyrefly-reported type diagnostics without changing scraper behavior.

Validation

  • ./scripts/check-all.sh
  • uv run pyrefly check --min-severity warn --summarize-errors
  • uv lock --check

Copilot AI review requested due to automatic review settings June 28, 2026 13:11
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@michaelmwu, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 4 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3cf5a42c-c069-4151-bf2b-5cfdc40478a3

📥 Commits

Reviewing files that changed from the base of the PR and between b6b5612 and 335563d.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • .pre-commit-config.yaml
  • pyproject.toml
  • scripts/typecheck.sh
  • src/gmaps_scraper/display_fields.py
  • src/gmaps_scraper/place_scraper.py
  • src/gmaps_scraper/translation_memory.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch michaelmwu/use-pyrefly-typecheck

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.

Copilot AI left a comment

Copy link
Copy Markdown

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 migrates the project’s static type checking workflow from mypy to Pyrefly, aligning local tooling (scripts and pre-commit) and CI to run pyrefly check under Python 3.14, and includes small code adjustments to satisfy Pyrefly’s type diagnostics without changing scraper behavior.

Changes:

  • Replaced mypy with pyrefly>=1.1.1 in dev dependencies and updated uv.lock accordingly.
  • Added strict Pyrefly configuration in pyproject.toml and routed scripts/typecheck.sh, pre-commit, and CI to use Pyrefly (with GitHub annotation output in CI).
  • Addressed type-checking issues via small, behavior-preserving typing/narrowing tweaks in a few modules.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
uv.lock Swaps mypy-related locked dependencies for Pyrefly and adds the Pyrefly lock entry.
src/gmaps_scraper/translation_memory.py Adds explicit runtime narrowing and typing for JSON-ish payload fields to satisfy stricter checking.
src/gmaps_scraper/place_scraper.py Removes a redundant str(...) cast while preserving the existing isinstance(value, str) filter.
src/gmaps_scraper/display_fields.py Adds an explicit list[str] annotation to keep diagnostics typing strict.
scripts/typecheck.sh Routes type checking through uv run pyrefly check, emitting GitHub-formatted annotations in Actions.
pyproject.toml Replaces [tool.mypy] with a strict [tool.pyrefly] configuration and updates dev deps.
.pre-commit-config.yaml Renames the local typecheck hook to Pyrefly while continuing to invoke ./scripts/typecheck.sh.
.github/workflows/ci.yml Renames the typecheck step to reflect Pyrefly (command remains ./scripts/typecheck.sh).

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

@michaelmwu michaelmwu merged commit 28daadc into main Jun 28, 2026
8 checks passed
@michaelmwu michaelmwu deleted the michaelmwu/use-pyrefly-typecheck branch June 28, 2026 13:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 335563dee6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
Comment on lines +39 to +40
preset = "strict"
check-unannotated-defs = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve strict annotation checks

When a new src function has annotated parameters but omits -> ..., this config no longer fails the typecheck gate: Pyrefly documents unannotated-return as default ignore, and check-unannotated-defs only checks function bodies, while the removed mypy strict = true enabled --disallow-untyped-defs/--disallow-incomplete-defs. Add the equivalent Pyrefly error overrides, e.g. for missing return annotations, if the previous strict typed-API gate is meant to be preserved.

Useful? React with 👍 / 👎.

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