Skip to content

Update pre-commit hooks to latest versions#34

Merged
ternaus merged 3 commits into
albumentations-team:mainfrom
Borda:update/precommit
Jan 14, 2026
Merged

Update pre-commit hooks to latest versions#34
ternaus merged 3 commits into
albumentations-team:mainfrom
Borda:update/precommit

Conversation

@Borda

@Borda Borda commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

This pull request updates several dependencies and configurations in the .pre-commit-config.yaml file to ensure the project uses the latest versions of linting and formatting tools, as well as to improve consistency in argument formatting.

Dependency version upgrades:

  • Upgraded pre-commit-hooks from v5.0.0 to v6.0.0 for the latest pre-commit checks.
  • Upgraded ruff-pre-commit from v0.12.1 to v0.14.11 and switched the linter hook from ruff to ruff-check for improved linting and formatting.
  • Upgraded pyproject-fmt from v2.6.0 to v2.11.1 for updated formatting capabilities.
  • Upgraded mypy from v1.16.1 to v1.19.1 and improved argument formatting for better type checking.
  • Upgraded pyright-python from v1.1.402 to v1.1.408 and updated the argument format for project configuration.

@ternaus I think that the pre-commit bot is not installed/enabled for this repo since, according to the config, it shall generate weekly updates, but none ever happen...

Summary by Sourcery

Update pre-commit configuration to use newer tooling versions and align hook arguments with current conventions.

Build:

  • Bump versions of pre-commit-hooks, ruff-pre-commit, pyproject-fmt, mypy, and pyright-python in .pre-commit-config.yaml and adjust hook IDs and arguments accordingly.

CI:

  • Refresh pre-commit hook configuration for linting, formatting, and type-checking to keep automated checks in sync with upstream tooling.

Copilot AI review requested due to automatic review settings January 14, 2026 09:26
@sourcery-ai

sourcery-ai Bot commented Jan 14, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

.pre-commit-config.yaml is updated to newer versions of several hooks (pre-commit-hooks, ruff, pyproject-fmt, mypy, pyright) and their arguments are normalized, including switching the Ruff hook id and simplifying type checker arguments.

File-Level Changes

Change Details Files
Upgrade core pre-commit hooks and keep existing checks intact.
  • Bump pre-commit/pre-commit-hooks from v5.0.0 to v6.0.0.
  • Retain the existing set of hooks (check-added-large-files, check-ast, check-builtin-literals, etc.) without behavioral config changes.
.pre-commit-config.yaml
Update Ruff integration and simplify its configuration.
  • Bump astral-sh/ruff-pre-commit from v0.12.1 to v0.14.11.
  • Switch linter hook id from ruff to ruff-check to match the current hook naming.
  • Remove the explicit exclude for pycache/ on the Ruff linter hook.
  • Keep ruff-format hook and its configuration unchanged.
  • Preserve auto-fix behavior via args: [ --fix ].
.pre-commit-config.yaml
Upgrade formatting and type-checking tool hooks and normalize their arguments.
  • Bump tox-dev/pyproject-fmt from v2.6.0 to v2.11.1.
  • Bump pre-commit/mirrors-mypy from v1.16.1 to v1.19.1.
  • Change mypy args from YAML list style [ --config-file=pyproject.toml ] to standard list items with quoted string "--config-file=pyproject.toml".
  • Bump RobertCraigie/pyright-python from v1.1.402 to v1.1.408.
  • Remove additional_dependencies: [.] from pyright hook (relying on environment instead).
  • Change pyright args from ["--project", "pyproject.toml"] to ["--project=pyproject.toml"] for more concise configuration.
.pre-commit-config.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The exclude: '__pycache__/' option was dropped from the Ruff hook; if you still want to skip those directories, consider re-adding the exclude (or a more general pattern) to the updated hook configuration.
  • Switching from ruff to ruff-check changes the hook ID; it may be worth confirming this matches the current upstream hook naming and that any tooling or CI references are updated accordingly.
  • The additional_dependencies: [.] entry for the Pyright hook was removed; if Pyright previously depended on installing the local package for type information, you may want to confirm that this is no longer necessary or reintroduce it explicitly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `exclude: '__pycache__/'` option was dropped from the Ruff hook; if you still want to skip those directories, consider re-adding the exclude (or a more general pattern) to the updated hook configuration.
- Switching from `ruff` to `ruff-check` changes the hook ID; it may be worth confirming this matches the current upstream hook naming and that any tooling or CI references are updated accordingly.
- The `additional_dependencies: [.]` entry for the Pyright hook was removed; if Pyright previously depended on installing the local package for type information, you may want to confirm that this is no longer necessary or reintroduce it explicitly.

## Individual Comments

### Comment 1
<location> `.pre-commit-config.yaml:79` </location>
<code_context>
       - id: pyright
         # Optional: specify files/directories to check, defaults to project root
         files: ^(benchmark|tools)/
-        additional_dependencies: [.]
         # Tell pyright to use the project config
-        args: ["--project", "pyproject.toml"]
+        args: ["--project=pyproject.toml"]
</code_context>

<issue_to_address>
**issue (testing):** Dropping `additional_dependencies: [.]` for pyright may cause missing-dependency errors in isolated pre-commit environments.

Without `additional_dependencies: [.]`, pyright in pre-commit will run without your package (and its runtime deps) installed in the hook venv. In clean CI runs this can surface as false unresolved-import or missing-type issues. If you still want pyright to reflect the real runtime environment, keep `additional_dependencies: [.]` or specify a minimal set of required deps instead.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .pre-commit-config.yaml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread .pre-commit-config.yaml
@ternaus ternaus merged commit e71aa9b into albumentations-team:main Jan 14, 2026
2 checks passed
@Borda Borda deleted the update/precommit branch January 14, 2026 12:21
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.

3 participants