Skip to content

Replace stale black and isort config with ruff - #31

Merged
glenn-jocher merged 2 commits into
mainfrom
pass2-pyproject
Aug 2, 2026
Merged

Replace stale black and isort config with ruff#31
glenn-jocher merged 2 commits into
mainfrom
pass2-pyproject

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Aug 2, 2026

Copy link
Copy Markdown
Member

Two pyproject/tooling corrections.

  • pyproject.toml configured [tool.black] and [tool.isort], but neither tool runs anywhere in this repo — .github/workflows/format.yml formats it with Ruff and docformatter via ultralytics/actions, matching the rest of the org. Replaced both tables with [tool.ruff] line-length = 120, which is what actually applies.
  • Cleared the executable bit on capitalize_comments.py (mode 100755 → 100644). The file has no shebang, so the bit never did anything, and ruff check flagged it as EXE002. It was a leftover from the old design where .pre-commit-hooks.yaml pointed entry at the filename; since Fix capitalize-comments hook entry point, add AGENTS.md #30 the hook runs through the capitalize-comments console script, so nothing executes the file directly.

Verified: with the new config ruff check . reports "All checks passed" (it reported the EXE002 error before the mode change) and ruff format --check . shows 4 files already formatted. Re-ran the hook via pre-commit try-repo against the committed branch state with a cleared pre-commit cache — it still installs and capitalizes correctly.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Modernizes project linting configuration by replacing Black and isort settings with Ruff and correcting a script file’s permissions. 🛠️

📊 Key Changes

  • Changed capitalize_comments.py from executable (755) to standard non-executable (644) permissions.
  • Replaced separate [tool.black] and [tool.isort] configuration sections with a unified [tool.ruff] section.
  • Preserved the project’s 120-character line-length setting.
  • Removed the isort Black-compatible profile because Ruff now manages formatting and import sorting. ✨

🎯 Purpose & Impact

  • Simplifies development tooling by consolidating linting and formatting configuration under Ruff.
  • Reduces redundant configuration and supports a more streamlined pre-commit workflow.
  • Prevents the comment-capitalization script from being treated as a directly executable file.
  • Maintains existing line-length behavior while improving tool consistency for contributors. ✅

@UltralyticsAssistant UltralyticsAssistant added the enhancement New feature or request label Aug 2, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/pre-commit 🚀 PR! This is an automated welcome message, and an engineer will assist with your review. Please check the following:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/pre-commit main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee
    For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Clean change. The obsolete Black and isort configuration is removed, and the replacement Ruff line-length setting matches the repository's Ruff-based formatting workflow. No actionable issues found.

@glenn-jocher
glenn-jocher merged commit 44a1c5c into main Aug 2, 2026
5 checks passed
@glenn-jocher
glenn-jocher deleted the pass2-pyproject branch August 2, 2026 19:02
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 Thank you, @glenn-jocher, for this thoughtful contribution—and congratulations on the merge!

“Great things are done by a series of small things brought together.” — Vincent van Gogh

By consolidating Black and isort settings under Ruff, preserving the 120-character line length, and correcting the script permissions, this PR simplifies tooling and creates a more consistent workflow for contributors. Your attention to these details helps keep the project clean, maintainable, and efficient. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants