Fix template doctests, ruff target version, and AGENTS.md drift - #100
Conversation
|
👋 Hello @glenn-jocher, thank you for submitting a
For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. This is an automated message, and an engineer will assist with any follow-up questions. Thank you for contributing to Ultralytics! 🚀 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
LGTM. The doctest examples now match runtime behavior, Ruff can infer the Python 3.9 target from project.requires-python, the obsolete setuptools package-data entry has no corresponding package, and the GitHub Actions token expression remains valid.
|
🎉 Thank you, @glenn-jocher, for this excellent contribution—and congratulations on the merge!
This PR puts that principle into practice by streamlining documentation, configuration, authentication, workflows, and examples. The result is a cleaner, safer, and more maintainable template that gives contributors clearer guidance and a smoother developer experience. Thank you for helping make the foundation stronger for everyone! |
Fixes found while standardizing this repo. Since every new Ultralytics Python project is copied from here, each of these propagates.
pytestfailed out of the box.addoptsincludes--doctest-modules, so a barepytestat the repo root collectstemplate/module1.pyand fails twice:add_numbersdocumentedtorch.Tensorarguments the signature does not accept and its example calledtorch.tensor(...)(torch is not a dependency →NameError), and themain()example expected no output whilemainprints. CI only ever runspytest tests, which is why this stayed hidden. Docstrings now match the real signature and output; barepytestgoes from 2 failed / 5 passed to 7 passed.target-version = "py310"contradictedrequires-python = ">=3.9". Withselect = ["UP"]this makes ruff rewriteOptional[int]toint | None, which is a runtime error on the 3.9 that CI still tests. Removed the line so ruff infers the target fromrequires-python, keeping the Python floor in one place — verified that the same file is clean before the change and flagged after.package-data = { "sample" = ["*.yaml"] }referenced asamplepackage that does not exist; setuptools silently ignored it. Removed.TOKEN:x-oauth-basicURL for what is a public repository. Simplified.format.yml: usesecrets.GITHUB_TOKENin the fallback to match every other Ultralytics repo.AGENTS.md: replace the drifted Core Principles and PR Workflow sections with the current org-standard text; repo-specific sections unchanged.Verified locally on 3.13: bare
pytest,pytest tests,unittest discover tests, both coverage variants,example-cli-command,ruff format --check, andruff checkall pass.🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Simplifies the template repository’s documentation, configuration, workflow authentication, and example code for a cleaner and more maintainable developer experience. ✨
📊 Key Changes
secrets.GITHUB_TOKENas the fallback authentication token.AGENTS.mdwith clearer contribution principles, emphasizing minimal changes, reuse, deletion of unnecessary code, and thorough validation.main.pyproject.tomlby removing the token-based Git URL.setuptoolspackage-data configuration and the hardcoded Ruff Python target version.add_numbers()documentation to reflect its supported integer and floating-point inputs.add_numbers()andmain()to show expected output directly.🎯 Purpose & Impact