Development Workflow 💻
This guide covers the development process for contributing to Ultralytics projects, including YOLO11 and related repositories.
Code of Conduct 🤝
All contributors must adhere to our Code of Conduct. Respect, kindness, and professionalism are at the heart of our community. For detailed contribution guidelines, see the Official Contributing Guide.
Pull Request Process 🔄
flowchart TD
A[Fork Repository] --> B[Create Feature Branch]
B --> C[Make Changes]
C --> D[Run Tests Locally]
D --> E[Commit Changes]
E --> F[Create Pull Request]
F --> G[Sign CLA]
G --> H{Review}
H -->|Changes Requested| I[Address Feedback]
I --> H
H -->|Approved| J[Merge!]
style A fill:#e1f5ff
style J fill:#d4edda
style G fill:#fff3cd
1. Fork the Repository
Fork the relevant Ultralytics repository (e.g., ultralytics/ultralytics) to your GitHub account.
2. Create Feature Branch
Create a branch with a clear, descriptive name:
Branch Naming Conventions
fix-issue-123for bug fixesadd-feature-xyzfor new featuresupdate-docs-trainingfor documentation
3. Make Your Changes
-
Follow Guidelines
Adhere to project style guidelines
-
Avoid Errors
Don't introduce new warnings
-
Stay Focused
Keep changes minimal and targeted
4. Test Your Changes
Testing Required
Test locally before submitting:
Add tests for new functionality to prevent regressions.
Learn more: Testing Requirements, Model Validation, CI Workflows
5. Commit Your Changes
Commit with concise, descriptive messages:
!!! tip "Commit Message Best Practices" - Use present tense ("Add feature" not "Added feature") - Reference issue numbers when applicable - Keep subject line under 72 characters
6. Create Pull Request
Submit PR from your branch to main:
- Clear title describing the change
- Detailed description of purpose and scope
- Link related issues
- Include screenshots for UI changes
- Tests passing locally
7. Sign the CLA
Required Before Merge
You must sign our Contributor License Agreement (CLA) to ensure contributions are properly licensed under the AGPL-3.0 license.
After submitting your PR, add this comment:
The CLA bot will guide you through the process. For more details on licensing, see our contributing guide.
8. Address Review Feedback
Respond to reviewer comments and push updates.
Google-Style Docstrings 📝
All functions and classes require Google-style docstrings with types in parentheses.
Standard Function
def example_function(arg1, arg2=4):
"""Example function demonstrating Google-style docstrings.
Args:
arg1 (int): The first argument.
arg2 (int): The second argument.
Returns:
(bool): True if arguments are equal, False otherwise.
Examples:
>>> example_function(4, 4) # True
>>> example_function(1, 2) # False
"""
return arg1 == arg2
Named Returns
def example_function(arg1, arg2=4):
"""Example function with named return.
Args:
arg1 (int): The first argument.
arg2 (int): The second argument.
Returns:
equals (bool): True if arguments are equal, False otherwise.
Examples:
>>> example_function(4, 4) # True
"""
equals = arg1 == arg2
return equals
Multiple Returns
def example_function(arg1, arg2=4):
"""Example function with multiple returns.
Args:
arg1 (int): The first argument.
arg2 (int): The second argument.
Returns:
equals (bool): True if arguments are equal, False otherwise.
added (int): Sum of both input arguments.
Examples:
>>> equals, added = example_function(2, 2) # True, 4
"""
equals = arg1 == arg2
added = arg1 + arg2
return equals, added
Important: Document each return value separately, not as a tuple.
✅ Good:
Returns:
(np.ndarray): Predicted masks with shape HxWxN.
(list): Confidence scores for each instance.
❌ Bad:
Returns:
(tuple): Tuple containing:
- (np.ndarray): Predicted masks with shape HxWxN.
- (list): Confidence scores for each instance.
With Type Hints
def example_function(arg1: int, arg2: int = 4) -> bool:
"""Example function with type hints.
Args:
arg1: The first argument.
arg2: The second argument.
Returns:
True if arguments are equal, False otherwise.
Examples:
>>> example_function(1, 1) # True
"""
return arg1 == arg2
Single-Line Docstrings
def example_small_function(arg1: int, arg2: int = 4) -> bool:
"""Example function with a single-line docstring."""
return arg1 == arg2
Code Standards 📐
Python Style
| Standard | Requirement | Example |
|---|---|---|
| Line Width | 120 characters max | Keep lines readable and scannable |
| Docstrings | Google-style | Types in parentheses |
| Imports | pathlib over os |
Modern, cross-platform paths |
| Type Hints | Use when beneficial | Improves IDE support |
| Functions | <50 lines ideally | Keep focused and testable |
Code Quality
Quality Checklist
- No unused imports or variables
- Consistent naming (
lowercase_with_underscores) - Clear variable names (avoid single letters except loop counters)
- Use f-strings for string formatting
- Comments only for complex logic
- Ruff Formatter for consistency
Best Practices
-
Avoid Duplication
Reuse existing code - DRY principle
-
Smaller Changes
Focused modifications > large-scale changes
-
Simplify
Look for simplification opportunities
-
Compatibility
Avoid breaking existing code
-
Add Tests
Include tests for new features
-
Consistent Format
Use Ruff Formatter
Testing Requirements ✅
All PRs must pass CI tests:
See CI/Testing for CI details.
Code Review Guidelines 👀
For Contributors
- Keep PRs focused on single feature/fix
- Respond promptly to feedback
- Don't take feedback personally
- Update PR description if scope changes
For Reviewers
- Review within 1-2 business days
- Check unit tests for new features
- Review documentation updates
- Evaluate performance impact
- Verify CI tests pass
- Provide constructive, specific feedback
- Recognize author's effort
Git Best Practices 🌳
Commits
- Present tense: "Add feature" not "Added feature"
- Clear, descriptive messages
- Focused, logical commits
Branches
- Pull latest
mainbefore creating branches - Rebase on
mainbefore final submission - Delete branches after merge
Reporting Bugs 🐞
Report bugs via GitHub Issues:
- Check existing issues first
- Provide Minimum Reproducible Example
- Describe environment: OS, Python version, library versions, hardware (use
yolo checksfor diagnostics) - Explain expected vs actual behavior with error messages
For common issues and solutions, see our troubleshooting guide.
License 📜
Ultralytics uses AGPL-3.0. If using Ultralytics code in your project, your entire project must be open-sourced under AGPL-3.0. If you prefer not to open-source, obtain an Enterprise License.
Resources 📚
- Official Contributing Guide - Complete contribution guidelines
- CI/Testing - Continuous integration details
- Documentation - Writing and maintaining docs
- Code of Conduct - Community standards
- Ultralytics Blog - Latest updates and tutorials
- Community Events - Webinars and conferences