Thank you for your interest in contributing to SensorAugmentor! This document provides guidelines and instructions for contributing to make the process smooth and effective for everyone involved.
- Code of Conduct
- Getting Started
- Development Process
- Reporting Bugs
- Feature Requests
- Pull Request Process
- Coding Standards
- Testing
- Documentation
- Community
By participating in this project, you agree to abide by our Code of Conduct. Please read CODE_OF_CONDUCT.md to understand what behaviors will and will not be tolerated.
- Python 3.8+
- PyTorch 1.9+
- Git
- Basic understanding of neural networks and sensor data processing
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/SensorAugmentor.git cd SensorAugmentor - Add the original repository as an upstream remote:
git remote add upstream https://github.com/ORIGINAL_OWNER/SensorAugmentor.git
- Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e . pip install -r requirements-dev.txt
Looking for a place to start?
- Look for issues tagged with
good-first-issueorhelp-wanted - Check the roadmap for future features you might want to work on
- Improve documentation or write tutorials
- Add tests or improve test coverage
main: The main development branch. All features, fixes, and changes will be merged here.release/X.Y.Z: Release branches for specific versions- For your contributions, create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make sure your
mainbranch is up to date:git checkout main git pull upstream main
-
Create your feature branch:
git checkout -b feature/your-feature-name
-
Make your changes and commit them with descriptive messages
-
Keep your branch updated with the main branch:
git fetch upstream git rebase upstream/main
-
Push your branch to your fork:
git push -u origin feature/your-feature-name
-
Create a pull request
Before submitting a bug report:
- Check the issue tracker to see if it's already reported
- Update your local repository to ensure the bug still exists in the latest version
- Determine if it's a bug in SensorAugmentor or in a dependency
When submitting a bug report, include:
- Clear, descriptive title
- Steps to reproduce the issue
- Expected behavior
- Actual behavior
- Environment details (OS, Python version, PyTorch version, etc.)
- Screenshots or code snippets if applicable
- Any relevant logs or error messages
Use the bug report template when opening an issue.
Feature requests are welcome! When submitting feature requests:
- Describe the feature in detail
- Explain why this feature would be valuable to the project
- Provide examples of how the feature would be used
- If possible, outline a suggested implementation approach
Use the feature request template when opening an issue.
- Ensure your code follows our coding standards
- Include tests for new features or bug fixes
- Update documentation to reflect any changes
- Ensure all tests pass:
python run_tests.py --all
- Make sure your branch is updated with the latest changes from
main - Create a pull request with a clear title and detailed description
- Link any relevant issues in your pull request description using keywords like "Fixes #123" or "Resolves #456"
- At least one maintainer will review your PR
- Feedback will be provided as comments on the PR
- Address any requested changes and push updates to the same branch
- Once approved, a maintainer will merge your PR
We follow PEP 8 with these additional guidelines:
- Use 4 spaces for indentation (not tabs)
- Maximum line length is 88 characters (aligned with Black formatter)
- Use docstrings for all public classes, methods, and functions
- Use type hints where appropriate
- Format code with Black and isort
We use the following tools for code quality:
- Black: For code formatting
- isort: For import sorting
- flake8: For style guide enforcement
- mypy: For type checking
Configuration files for these tools are in the repository.
- Use Google-style docstrings
- Include type information in docstrings
- Document parameters, return values, and exceptions
- Include examples where appropriate
Example:
def process_sensor_data(data: np.ndarray, normalize: bool = True) -> np.ndarray:
"""
Process raw sensor data for input to the model.
Args:
data: Raw sensor readings with shape (batch_size, sensor_dim)
normalize: Whether to normalize the data
Returns:
Processed sensor data ready for model input
Raises:
ValueError: If data dimensions are incorrect
Example:
>>> raw_data = np.random.randn(10, 32)
>>> processed = process_sensor_data(raw_data)
>>> print(processed.shape)
(10, 32)
"""
# Implementation- Unit tests: Test individual components in isolation
- Integration tests: Test multiple components working together
- Performance tests: Benchmark tests marked with the
benchmarkmarker
Run all tests:
python run_tests.py --allRun specific test types:
python run_tests.py unit # Run only unit tests
python run_tests.py integration # Run only integration tests
python run_tests.py benchmark # Run only benchmark testsRun with coverage:
python run_tests.py --coverage- Each test file should focus on a specific component or feature
- Use descriptive test names that explain what is being tested
- Use fixtures for common setup
- Use parameterized tests for testing multiple cases
- Mark slow tests with
@pytest.mark.slow - Include both positive and negative test cases
Example:
import pytest
import torch
from sensor_actuator_network import ResidualBlock
class TestResidualBlock:
@pytest.fixture
def setup(self):
return {"dim": 64, "batch_size": 32}
def test_output_shape(self, setup):
"""Test that output shape matches input shape."""
block = ResidualBlock(setup["dim"])
x = torch.randn(setup["batch_size"], setup["dim"])
out = block(x)
assert out.shape == x.shape- API Reference: Document all public classes and functions
- Tutorials: Step-by-step guides for common tasks
- How-to Guides: Instructions for specific problems
- Explanation: Background information and concepts
- Examples: Working code examples
When making changes that affect documentation:
- Update docstrings in code
- Update relevant Markdown files in the
docs/directory - Add examples or tutorials for new features
- Ensure links between documentation pages remain valid
- Join our Discord server for real-time discussions
- Sign up for our mailing list for announcements
- Follow us on Twitter for updates
All contributors will be recognized in our CONTRIBUTORS.md file and on the project website.
Thank you for contributing to SensorAugmentor! Your efforts help make this project better for everyone.