pypi ultralytics 8.3.221
v8.3.221 - `ultralytics 8.3.221` Ruff `RUF` refactor (#22475)

3 days ago

🌟 Summary

v8.3.221 focuses on a large Ruff-driven codebase refactor that modernizes typing, cleans imports/variables, and polishes formatting/logging with minimal behavioral change. It also tightens docs CI linting, fixes exception logging patterns, updates ExecuTorch docs links, and improves test isolation. ✨

πŸ“Š Key Changes

  • Codebase-wide Ruff refactor (current PR) by @glenn-jocher:
    • Modern type hints using PEP 604 unions (e.g., Path | None, dict | None).
    • Cleanup of unused variables, fewer # noqa, standardized imports, safer disk-usage vars.
    • More Pythonic constructs (iterable unpacking, next(...) for first matches, clearer f-string formatting with !s, !r).
    • Consistent rounding in image padding/letterbox flows: int(round(...)) β†’ round(...).
    • Reordered __all__ exports and minor logging/output polish.
  • Docs and CI improvements:
    • Stricter Ruff rules (Pyflakes F) enabled in docs workflow to catch undefined names and unused imports earlier. See the updated workflow in docs CI.
    • Exception logging simplified from str(e) to f"{e}" across code and docs for cleaner messages.
    • ExecuTorch docs link updated to the correct backend setup page. See the updated ExecuTorch docs.
  • Testing reliability:
    • Test suite now uses pytest’s built-in tmp_path for better isolation and parallel test stability, replacing ad-hoc TMP dir usage.

References:

  • Current PR: ultralytics 8.3.221 Ruff RUF refactor
  • Docs CI linting: Use --extend-select F in docs.yml
  • Exception logging cleanup: Use f"{e}"
  • ExecuTorch doc fix: Fix ExecuTorch docs URL

🎯 Purpose & Impact

  • Developer experience πŸ§‘β€πŸ’»
    • Cleaner, more consistent codebase and type hints improve IDE assistance, readability, and maintenance.
    • Stricter CI linting catches common issues earlier, leading to higher-quality contributions.
  • User experience πŸš€
    • No model or API changes; performance and results remain consistent for YOLO11 and other models.
    • Slightly more consistent image padding behavior from rounding standardization in examples/utilities; impact should be negligible.
  • Documentation & reliability πŸ“šπŸ”§
    • Correct ExecuTorch links reduce setup confusion.
    • Test isolation via tmp_path improves CI stability and confidence in releases.

Upgrade note: No action required. If contributing, ensure your PRs pass the stricter Ruff checks and follow the updated exception/logging patterns. βœ…

What's Changed

Full Changelog: v8.3.220...v8.3.221

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.