Skip to content

Conversation

@cesarcoatl
Copy link
Member

@cesarcoatl cesarcoatl commented Jun 14, 2025

Summary by Sourcery

Integrate the unimport hook into the project toolchain, streamline the style environment in tox, and refresh README badges.

CI:

  • Reorder and add the unimport hook in .pre-commit-config.yaml before isort
  • Set the style tox environment to Python 3.12, include unimport, and replace the bash sort-all invocation with a Python-based file discovery script
  • Remove the allowlist_externals bash restriction
  • Update the type-checking tox environment to use Python 3.12

Documentation:

  • Refresh README badges to display PyPI version and download statistics

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 14, 2025

Reviewer's Guide

The PR reorders the unimport hook in the pre-commit configuration, enhances the tox style environment by pinning Python 3.12, integrating unimport, and replacing the bash-based sort-all command, and refreshes README badges to show the PyPI version and static download counts.

Flow Diagram: Updated Tox [testenv:style] Command Sequence

graph TD
    A[Start tox -e style] --> B["python -c '...' (sort-all)"]
    B --> C["ssort src"]
    C --> D["black --quiet src"]
    D --> E["unimport src"]
    E --> F["isort src"]
    F --> G["flake8 src"]
    G --> H["pydocstyle src"]
    H --> I[End tox -e style]
Loading

File-Level Changes

Change Details Files
Reorder and relocate the unimport hook in pre-commit config
  • Insert unimport hook immediately after black
  • Remove unimport hook from its previous position
  • Adjust indentation to match surrounding entries
.pre-commit-config.yaml
Enhance tox style environment with Python 3.12 and unimport integration
  • Add base_python = python3.12 for style env
  • Include unimport in style dependencies
  • Replace bash-based sort-all find invocation with a Python script
  • Add unimport src command to style commands
  • Remove allowlist_externals for bash
tox.ini
Update README badges to use current PyPI version and static download badge
  • Swap pepy.tech downloads badge for static pepy.tech badge
  • Add PyPI version badge
  • Update badge URLs to point at pypi.org and pepy.tech
README.md

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

@cesarcoatl cesarcoatl merged commit 70618da into main Jun 14, 2025
4 checks passed
@cesarcoatl cesarcoatl deleted the build/pre-commit/reorder-hooks branch June 14, 2025 22:16
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @cesarcoatl - I've reviewed your changes - here's some feedback:

  • In tox.ini’s style env, add check=True to the subprocess.run call so formatting failures actually break the build.
  • The inline Python one-liner in tox.ini is hard to maintain—consider extracting it to a small script or using a simple bash command with allowlist_externals instead.
  • Double-check your pre-commit hook order to ensure unimport runs at the most effective point (e.g. after import sorting) in your pipeline.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In tox.ini’s style env, add `check=True` to the `subprocess.run` call so formatting failures actually break the build.
- The inline Python one-liner in tox.ini is hard to maintain—consider extracting it to a small script or using a simple bash command with `allowlist_externals` instead.
- Double-check your pre-commit hook order to ensure `unimport` runs at the most effective point (e.g. after import sorting) in your pipeline.

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.

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