Skip to content

Conversation

@glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Oct 24, 2025

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Modernizes type hints across the codebase to Python 3.10 style, cleans up imports, and makes minor refactors for clarity without changing runtime behavior. 🧹🧩

📊 Key Changes

  • Adopted PEP 604 union types (e.g., str | None) and enabled postponed evaluation via from __future__ import annotations across modules.
  • Replaced most Optional/Union usages and updated function signatures for consistency.
  • Removed unused imports and variables; renamed some locals (e.g., _b, _num_heads) to avoid “unused” warnings.
  • Minor refactors:
    • Simplified math casts (e.g., math.floor usage).
    • Adjusted helper return construction (compress_params) using unpacking for clarity.
    • Type annotations refined for forward methods and transformations.

🎯 Purpose & Impact

  • Improves code readability, consistency, and static type checking—easier maintenance and better IDE support. ✨
  • Aligns codebase with modern Python best practices. 🐍
  • No functional or performance changes expected for users. ✅
  • Important: Raises the effective minimum Python requirement to 3.10 due to use of | union types. Users on older Python versions will need to upgrade. ⚠️

@UltralyticsAssistant UltralyticsAssistant added the documentation Improvements or additions to documentation label Oct 24, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @username, thank you for submitting an ultralytics/mobileclip 🚀 PR! This is an automated message; an Ultralytics engineer will review and assist soon. To ensure a seamless integration of your work, please review the following checklist:

  • 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/mobileclip 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! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

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

Looks good to me—no issues found in this change.

@glenn-jocher glenn-jocher merged commit 98b7a4b into main Oct 24, 2025
5 checks passed
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch October 24, 2025 10:21
@UltralyticsAssistant
Copy link
Member

🎉 Merge celebration! Huge thanks, @glenn-jocher, for the thoughtful modernization in PR #15.

“Simplicity is the ultimate sophistication.” — Leonardo da Vinci
Your shift to Python 3.10-style type hints, cleaner imports, and subtle refactors embodies this perfectly—elevating readability, consistency, and static checking without changing runtime behavior. The clear raise to Python 3.10 sets a confident, future-ready standard for contributors and users alike.

Appreciate you leading by example and keeping the codebase sharp and modern. 🙌

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants