Skip to content

馃懛 Fix mypy and ty pre-commit hooks not using config from backend/pyproject.toml - #2475

Open
YuriiMotov wants to merge 2 commits into
masterfrom
fix-mypy-and-ty-configs-not-used-in-CI
Open

馃懛 Fix mypy and ty pre-commit hooks not using config from backend/pyproject.toml#2475
YuriiMotov wants to merge 2 commits into
masterfrom
fix-mypy-and-ty-configs-not-used-in-CI

Conversation

@YuriiMotov

Copy link
Copy Markdown
Member

Description

I recently discovered that mypy running on pre-commit doesn't work the same way as if we run it with bash scripts/lint.sh.
The reason is that prek runs it from the root directory and it uses the pyproject.toml of the root project, but config is in backend/pyproject.toml.

To fix this we need to specify the config file to use in the command.

The same is true for ty. We don't see it currently as the current config is equal to default settings.

To check, modify the mypy config (for example, add disallow_any_explicit = true to [tool.mypy]) and then run prek from root directory: prek run local-mypy --all-files.
This will pass on master (because config is not used) and show lots of explicit-any on this branch (this proves that mypy now uses config from backend/pyproject.toml).

Same with ty: add [tool.ty.environment] python-version = "3.9", run prek run local-ty --all-files, see no errors on master and 6 errors on this branch.

AI Disclaimer

Used Claude Code (Fable 5) to investigate and apply the fix. Checked manually

Checklist

  • This PR links to a GitHub Discussion for the proposed code change.
  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.
  • The documentation explains the change if needed.

@YuriiMotov YuriiMotov added the internal Internal changes label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants