Skip to content

MPT-22538 align mypy pre-commit hook env with project runtime deps#355

Merged
jentyk merged 1 commit into
mainfrom
bugfix/MPT-22538/pre-commit-mypy-hook-fails-locally-project-httpx-runtime-deps-missing-hook-env
Jun 23, 2026
Merged

MPT-22538 align mypy pre-commit hook env with project runtime deps#355
jentyk merged 1 commit into
mainfrom
bugfix/MPT-22538/pre-commit-mypy-hook-fails-locally-project-httpx-runtime-deps-missing-hook-env

Conversation

@jentyk

@jentyk jentyk commented Jun 23, 2026

Copy link
Copy Markdown
Member

🤖 AI-generated PR — Please review carefully.

What

Add the project runtime dependencies (httpx==0.28.*, httpx-retries==0.5.*) to the mirrors-mypy hook's additional_dependencies in .pre-commit-config.yaml, mirroring the pins in pyproject.toml [project].dependencies.

Why

The mypy pre-commit hook runs in an isolated environment that previously installed only python-box. With httpx missing there, mypy strict = true + ignore_missing_imports = true made httpx.Auth collapse to Any, and disallow_subclassing_any failed locally on unchanged code:

mpt_api_client/auth/base.py:13: error: Class cannot subclass "Auth" (has type "Any")  [misc]

CI runs mypy with the full project dependencies (make check-all / uv run mypy .) and stayed green, so this only bit developers running pre-commit run locally. Aligning the hook's environment with the project's runtime deps removes the discrepancy.

Testing

  • uv run pre-commit run mypy --all-files → passes
  • Full pre-commit run --all-files, plus ruff format --check, ruff check, flake8, mypy, uv lock --check → green
  • pytest tests/unit → 2310 passed, 99% coverage

Closes MPT-22538

  • Added httpx==0.28.* and httpx-retries==0.5.* to the mirrors-mypy hook's additional_dependencies in .pre-commit-config.yaml to align the mypy pre-commit environment with project runtime dependencies
  • Resolves false positive mypy errors triggered locally when running pre-commit run due to missing type information for httpx.Auth in the isolated pre-commit environment
  • Eliminates the discrepancy between local and CI mypy environments, ensuring consistent type checking across workflows

The mirrors-mypy hook runs in an isolated environment whose
additional_dependencies only listed python-box, so httpx was not
installed there. With mypy strict + ignore_missing_imports, httpx.Auth
collapsed to Any and disallow_subclassing_any failed locally on
mpt_api_client/auth/base.py ("Class cannot subclass Auth"). CI runs
mypy with full deps (make check-all) and stayed green, so this only
affected developers running pre-commit locally.

Add httpx==0.28.* and httpx-retries==0.5.* to the hook's
additional_dependencies, mirroring the pins in pyproject.toml
[project].dependencies, so the hook env matches the project and
`pre-commit run mypy` passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jentyk jentyk requested a review from a team as a code owner June 23, 2026 18:35
@jentyk jentyk requested review from alephsur and d3rky June 23, 2026 18:35
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 49e7c3c8-8276-45dc-ac42-e4f93ff0fa64

📥 Commits

Reviewing files that changed from the base of the PR and between 14b6b5d and 6e521ab.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • softwareone-platform/mpt-extension-skills (manual)
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: build
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-16T11:49:53.579Z
Learnt from: jentyk
Repo: softwareone-platform/mpt-api-python-client PR: 303
File: tests/e2e/helpdesk/chats/participants/conftest.py:25-31
Timestamp: 2026-04-16T11:49:53.579Z
Learning: In tests/e2e/helpdesk/chats/participants/conftest.py (E2E fixtures `created_chat_participant` and `async_created_chat_participant`), it’s acceptable to omit participant teardown/cleanup. The parent `created_chat` fixture performs cascade-deletion of the chat and all related records (including participants) during teardown, so missing participant-specific cleanup should not be flagged in code review.

Applied to files:

  • .pre-commit-config.yaml
🔇 Additional comments (1)
.pre-commit-config.yaml (1)

44-45: LGTM!


📝 Walkthrough

Walkthrough

Two entries, httpx==0.28.* and httpx-retries==0.5.*, are added to the additional_dependencies list of the mypy pre-commit hook in .pre-commit-config.yaml. No other configuration is changed.

Changes

mypy pre-commit dependency update

Layer / File(s) Summary
Add httpx and httpx-retries to mypy hook
.pre-commit-config.yaml
httpx==0.28.* and httpx-retries==0.5.* are appended to the mypy hook's additional_dependencies list.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Documentation Up To Date ✅ Passed Change updates pre-commit hook dependencies (httpx, httpx-retries) to fix environment alignment; this is a dependency-bump/CI-only change with no new user-facing behavior requiring documentation up...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

✅ Found Jira issue key in the title: MPT-22538

Generated by 🚫 dangerJS against 6e521ab

@sonarqubecloud

Copy link
Copy Markdown

@jentyk jentyk merged commit 68151bd into main Jun 23, 2026
7 checks passed
@jentyk jentyk deleted the bugfix/MPT-22538/pre-commit-mypy-hook-fails-locally-project-httpx-runtime-deps-missing-hook-env branch June 23, 2026 18:44
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