Update pre-commit & linting configuration#3215
Merged
deruyter92 merged 12 commits intoDeepLabCut:jaap/reformat_codebasefrom Mar 20, 2026
Merged
Update pre-commit & linting configuration#3215deruyter92 merged 12 commits intoDeepLabCut:jaap/reformat_codebasefrom
deruyter92 merged 12 commits intoDeepLabCut:jaap/reformat_codebasefrom
Conversation
This was referenced Feb 23, 2026
3 tasks
C-Achard
approved these changes
Feb 25, 2026
6 tasks
C-Achard
approved these changes
Mar 16, 2026
MMathisLab
approved these changes
Mar 19, 2026
4fd852d
into
DeepLabCut:jaap/reformat_codebase
2 of 3 checks passed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of the task described in issue #3217
Motivation:
Pre-commit hooks and proper linting has not been applied consistently in existing codebase. Following DeepLabCut/DeepLabCut-live#165, it would be great to introduce a modern and consistent linting configuration again, after reformatting the codebase.
Order of merging:
Then merge the current PR, to update the linting configuration in the pyproject.toml and the pre-commit hooks.edit: merging this PR into PR Apply linting to entire codebase & add CI workflow to check linting #3216, since it requires simultaneous introduction in the main branch.
Current ruleset
E — Pycodestyle Errors:
Enforces basic style guidelines such as spacing, indentation, and line formatting, helping maintain a consistent style.
F — Pyflakes Errors:
Helps catch code issues like unused variables, undefined names, and logical mistakes that could lead to runtime errors.
B — Bugbear Rules:
Highlights code patterns that are likely to cause bugs or unexpected behavior (e.g., mutable defaults, overly broad exceptions), improving reliability and safety.
I — Import Sorting (isort):
Ensures imports follow a consistent, predictable order, reducing merge conflicts and making dependencies easier to scan.
UP — pyupgrade Rules:
Automatically upgrades syntax to modern Python features (aligned with Python 3.10), simplifying code and reducing technical debt.
Ignored rule(s):
E741 — Ambiguous Variable Names:
Ignored to avoid false positives when short variable names (like l, I, O) are acceptable or intentional.
Scope
(Copies the changes in DeepLabCut/DeepLabCut-live#165, by @C-Achard)