Skip to content

build: replace mypy with Pyrefly for type checking#57

Merged
kthy merged 1 commit into
mainfrom
feature/pyrefly
Jul 24, 2026
Merged

build: replace mypy with Pyrefly for type checking#57
kthy merged 1 commit into
mainfrom
feature/pyrefly

Conversation

@kthy

@kthy kthy commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description of PR

Swap the static type checker from mypy to Pyrefly, matching the setup already used in Utiligize/assetlife-api.

  • pyproject.toml: [tool.mypy] and the onepassword.* ignore_missing_imports override are replaced by [tool.pyrefly] (project-includes = ["src", "tests"], python-platform = "linux", python-version = "3.12") plus [tool.pyrefly.errors] promoting redundant-cast, redundant-condition and unused-coroutine to errors. The import override is no longer needed: the 1Password SDK ships type information that Pyrefly resolves.
  • .justfile: lint and lint-ci now run uv run pyrefly check --min-severity warn from the repo root.
  • Dev dependency mypy>=1.18pyrefly>=1,<2.
  • mypy's disallow_untyped_defs has no Pyrefly equivalent, so annotation enforcement moves to Ruff's ANN rules. ANN401 is ignored (the deliberate Any in the hydration and logging helpers) and tests/ is exempt.
  • Type checking now covers tests/ as well as src/, which surfaced three issues: OP_TOKEN is read with a "" default so it is str rather than str | None, the mock_vault kwargs dict is annotated dict[str, Any], and the SDK-version-conditional VaultOverview(**kwargs) call carries a # pyrefly: ignore[missing-argument].
  • .gitignore mypy cache entries removed; AGENTS.md type-hint guidance updated; CHANGELOG entry added.

Link to the Jira ticket

No ticket — tooling chore, aligning this repo's type checker with Utiligize/assetlife-api.

How to verify that it worked

uv sync --all-extras --dev
just lint   # ruff format + ruff check + pyrefly: 0 diagnostics
just test   # 54 passed, 1 skipped (e2e skipped without OP_TOKEN)

No runtime code in src/configator changed, so package behaviour is unaffected.

Are the changes in this PR covered by tests run by the CI workflow? - If no, then describe how it was tested below the checkboxes.

  • No
  • Yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Changed

    • Replaced MyPy with Pyrefly for static type checking.
    • Extended type checking coverage to include test code.
    • Updated linting and typing rules to improve consistency across the project.
  • Bug Fixes

    • Improved integration test handling when the required token is unavailable.
    • Added compatibility handling for SDK field differences in tests.

Swap the type checker to Pyrefly, matching the setup in
Utiligize/assetlife-api. Pyrefly now checks tests/ as well as src/, so
two test-only type errors are fixed and one SDK-version-conditional
construction gets an ignore comment.

mypy's disallow_untyped_defs has no Pyrefly equivalent, so annotation
enforcement moves to Ruff's ANN rules (ANN401 ignored for the
deliberate Any in the hydration and logging helpers; tests exempt).

Co-Authored-By: Claude <noreply@anthropic.com>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpyrefly@​1.1.1100100100100100

View full report

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fcaa30d6-8182-4e16-87a8-d44390ddb260

📥 Commits

Reviewing files that changed from the base of the PR and between 7912d7f and 7971e87.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • .gitignore
  • .justfile
  • AGENTS.md
  • CHANGELOG.md
  • pyproject.toml
  • tests/test_core.py
  • tests/test_e2e.py
💤 Files with no reviewable changes (1)
  • .gitignore

📝 Walkthrough

Walkthrough

The project replaces MyPy with Pyrefly for static type checking, updates Ruff and lint workflow configuration, narrows typing guidance to src/, documents the migration, and adjusts tests for new typing diagnostics and empty-token handling.

Changes

Pyrefly migration

Layer / File(s) Summary
Pyrefly tooling configuration
.gitignore, pyproject.toml
MyPy configuration and dependency entries are replaced with Pyrefly settings, Ruff typing rules are adjusted, and MyPy artifact ignores are removed.
Lint workflow and typing guidance
.justfile, AGENTS.md, CHANGELOG.md
Lint tasks run Pyrefly, typing guidance references Ruff and Pyrefly for src/, and the unreleased changelog records the migration and expanded test coverage.
Test typing adaptations
tests/test_core.py, tests/test_e2e.py
Test fixtures add explicit typing and a Pyrefly diagnostic suppression; the end-to-end test defaults missing tokens to an empty string and skips on falsy values.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating type checking from mypy to Pyrefly.
Description check ✅ Passed The description fills all required sections, includes verification steps, and states that CI covers the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/pyrefly

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

@sonarqubecloud

Copy link
Copy Markdown

@kthy
kthy merged commit 7844a80 into main Jul 24, 2026
7 checks passed
@kthy
kthy deleted the feature/pyrefly branch July 24, 2026 08:08
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