-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The way that pre-commit installs tools via git tags and ignores the environment in use is neat but kind of annoying, since it means either duplicating them, only using the tool via pre-commit, or bypassing the typical setup with a "system" pre-commit configuration. For ruff I've removed it from the venv and can only use it via pre-commit, which seems fine since I only use it in simple ways, but could become annoying later. In the case of mypy I immediately ran into a problem with the fact that I would need to specify my dependencies (or type stubs for them) in the pre-commit configuration to get it to work correctly in the isolated environment. I absolutely don't want that duplication, so instead I'm using the "system" workaround, which isn't much extra configuration. This follows the logic described here: python/mypy#13916. I also disabled pass_filenames due to it not making much sense with mypy, as described there. Another pain point is needing to have pre-commit available to commit, which right now means activating the appropriate environment. Probably a case where pipx would be ideal, but I don't feel like setting it up right now.
- Loading branch information
Showing
4 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.6.6 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format | ||
# Following recommendations from https://github.com/python/mypy/issues/13916 | ||
# This does make the mypy step slower | ||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
language: system | ||
entry: mypy | ||
types_or: [python, pyi] | ||
args: ["--strict", ""] | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters