Thank you for your interest in contributing to WorldEngine! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Workflow
- Code Style Guidelines
- Testing
- Submitting Changes
- Reporting Issues
- Feature Requests
By participating in this project, you agree to abide by our Code of Conduct. Please read it before contributing.
- Python 3.8+ (AlgEngine) or Python 3.9+ (SimEngine)
- CUDA 11.8
- PyTorch 2.0.1
- Git
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/WorldEngine.git cd WorldEngine -
Add the upstream remote:
git remote add upstream https://github.com/OpenDriveLab/WorldEngine.git
-
Install dependencies:
For SimEngine (Python 3.9):
bash scripts/install_simengine.sh
For AlgEngine (Python 3.8):
bash scripts/install_algengine.sh
-
Verify installation:
# Run quick test bash scripts/closed_loop_test.sh
Always create a new branch for your work:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation updatesrefactor/- Code refactoringtest/- Test additions or updates
Regularly sync with the upstream repository:
git fetch upstream
git rebase upstream/mainWe follow PEP 8 with some modifications:
- Line length: Maximum 120 characters
- Imports: Organize imports in the following order:
- Standard library imports
- Related third-party imports
- Local application/library imports
- Docstrings: Use Google-style docstrings
- Type hints: Add type annotations for function signatures
Example:
from typing import List, Optional
import numpy as np
from .utils import helper_function
def process_data(
input_data: np.ndarray,
threshold: float = 0.5,
debug: bool = False
) -> List[float]:
"""Process input data and return filtered results.
Args:
input_data: Input numpy array to process
threshold: Minimum value threshold for filtering
debug: Enable debug logging
Returns:
List of processed values that exceed the threshold
Raises:
ValueError: If input_data is empty
"""
if len(input_data) == 0:
raise ValueError("Input data cannot be empty")
results = []
for value in input_data:
if value > threshold:
results.append(float(value))
return resultsWe recommend using automated formatters:
- black: For code formatting (line length 120)
- isort: For import sorting
- flake8: For linting
Install pre-commit hooks to automatically format code:
pip install pre-commit
pre-commit install- Add docstrings to all public classes, methods, and functions
- Update relevant documentation when adding features
- Keep comments clear and concise
- Use inline comments sparingly - prefer self-documenting code
Before submitting a pull request, ensure all tests pass:
# Run quick test
bash scripts/closed_loop_test.sh
# Run distributed test (multi-GPU)
bash scripts/multigpu_closed_loop_test.sh- Add tests for new features
- Ensure tests are deterministic and reproducible
- Test edge cases and error conditions
- Use descriptive test names that explain what is being tested
Example:
def test_process_data_with_valid_input():
"""Test process_data with valid input returns expected results."""
input_data = np.array([0.3, 0.6, 0.9])
result = process_data(input_data, threshold=0.5)
assert len(result) == 2
assert result == [0.6, 0.9]
def test_process_data_with_empty_input_raises_error():
"""Test process_data raises ValueError for empty input."""
with pytest.raises(ValueError):
process_data(np.array([]))-
Ensure your code follows the style guidelines
-
Update documentation if needed
-
Add or update tests as appropriate
-
Commit your changes with clear, descriptive messages:
git add . git commit -m "feat: add trajectory prediction module - Implement LSTM-based trajectory predictor - Add unit tests for predictor - Update documentation with usage examples"
Commit message format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Test updateschore:- Maintenance tasks
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub:
- Use a clear, descriptive title
- Reference related issues (e.g., "Fixes #123")
- Describe your changes in detail
- Include screenshots for UI changes
- List any breaking changes
- Be responsive to reviewer feedback
- Make requested changes in new commits (don't force push)
- Once approved, a maintainer will merge your PR
- Check if the issue already exists
- Verify you're using the latest version
- Collect relevant information:
- Python version
- PyTorch version
- CUDA version
- Operating system
- Error messages and stack traces
Use our issue templates to report:
- Bug reports: Problems with the code
- Feature requests: Suggestions for new features
Provide as much detail as possible to help us understand and reproduce the issue.
We welcome feature requests! When suggesting a feature:
- Search existing issues to avoid duplicates
- Describe the problem your feature would solve
- Explain your proposed solution in detail
- Consider alternatives and explain why your solution is best
- Provide examples of how the feature would be used
If you have questions about contributing:
- Open a Discussion
- Check the FAQ in the README
- Review existing Issues
By contributing to WorldEngine, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to WorldEngine! 🚀