Skip to content

Share YOLO login with the SDK and automatically release generator updates - #56

Merged
glenn-jocher merged 3 commits into
mainfrom
feat/shared-platform-auth
Sep 7, 2026
Merged

Share YOLO login with the SDK and automatically release generator updates#56
glenn-jocher merged 3 commits into
mainfrom
feat/shared-platform-auth

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Sep 7, 2026

Copy link
Copy Markdown
Member

A user who has run yolo login currently has to provide the same key again to the standalone SDK. Keep Ultralytics credential discovery in the SDK-owned auth.py, included in both clients through the converter's optional python.authProvider hook. Explicit credentials override the environment, which overrides the saved login; an explicit empty string disables authentication. Logout affects newly created clients, and the SDK reads settings without importing the ML package or writing a second credential store.

The existing daily synchronization already follows the live API contract and ultralytics/openapi main. Generator-only updates previously retained the published version, so they could merge without reaching PyPI. Extend that workflow to increment the existing Python version override as a post-release only when generated output changes at the same version, and remove the override when the API contract version advances. Unchanged reruns produce no release. This also releases shared authentication as 0.1.31.post1 without changing the API contract.

Generated output depends on ultralytics/openapi#48, which removes application-specific policy from the converter. No generated files are maintained manually, and no new release workflow or generator version option is introduced. The additions above the usual 50-line threshold consist of the SDK-owned credential provider, its reproducible generated copy, and version handling in the existing synchronization owner; they cover separate required runtime and publication behavior without duplicate stores or test scaffolding. A consumer source file is necessary because the existing package directory is generated; storing the policy there directly would lose it on regeneration.

Validation: existing SDK suite on Python 3.11 and 3.14, Ruff, package build; actual published and current-main yolo login/logout with both clients over local HTTP using isolated settings and dummy credentials; explicit/environment/saved precedence, anonymous opt-out, malformed settings, read-only settings, and no ML imports. Executed the actual workflow steps with real generation for unchanged output, an SDK-only update and repeat, and a new contract version and repeat. All passed.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

The SDK now reuses credentials saved by yolo login and automatically creates post-release versions for generator-only updates.

📊 Key Changes

  • Added SDK-owned credential discovery through the generated authProvider hook, reading existing Ultralytics settings without importing the ML package or maintaining a separate credential store.
  • Updated synchronous and asynchronous clients to resolve credentials in this order: explicit api_key, ULTRALYTICS_API_KEY, then the saved login; an explicit empty string disables authentication.
  • Documented support for yolo login, yolo logout, anonymous authentication, and supported settings directories.
  • Extended the existing synchronization workflow to increment the Python .post version when generated output changes without an API contract version change, clear the override for new contract versions, and skip unchanged reruns.
  • Released the SDK-only authentication update as 0.1.31.post1.

🎯 Purpose & Impact

  • Users who have authenticated with yolo login can create either SDK client without supplying the key again, while explicit credentials and environment variables retain precedence.
  • Generator-only changes can now produce PyPI releases; unchanged synchronization runs do not create releases, and API contract version changes continue to determine the base package version.

@UltralyticsAssistant UltralyticsAssistant added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 7, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/sdk 🚀 PR! This automated message confirms your contribution was received, and an Ultralytics engineer will assist with the review. 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/sdk 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

Reviewed all 9 changed files, including credential resolution, generated-client wiring, and CI version synchronization. I found no concrete correctness, compatibility, security, or performance issue in the diff. LGTM.

@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 2

Made with ❤️ by Ultralytics Actions

Since review 1, the credential-resolution and generator version-sync changes remain consistent, with no newly introduced or still-open concrete defects found in the current diff. LGTM.

@glenn-jocher
glenn-jocher merged commit c1ded73 into main Sep 7, 2026
7 of 9 checks passed
@glenn-jocher
glenn-jocher deleted the feat/shared-platform-auth branch September 7, 2026 16:45
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 The PR has been merged—thank you, @glenn-jocher!

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

This update brings together smoother SDK authentication through saved yolo login credentials and reliable post-release generation for generator-only changes, while keeping explicit credential precedence and skipping unchanged releases.

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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants