We welcome contributions to Clustrix! This document provides guidelines for contributing to the project.
- Python 3.8 or higher
- Git
-
Clone the repository:
git clone https://github.com/ContextLab/clustrix.git cd clustrix -
Install in development mode:
pip install -e ".[dev]" -
Install pre-commit hooks (optional but recommended):
pip install pre-commit pre-commit install
Before submitting any code, please ensure it meets our quality standards:
-
Format your code:
black clustrix/
-
Run linting:
flake8 clustrix/
-
Type checking:
mypy clustrix/
-
Run tests:
pytest
We maintain comprehensive test coverage. When contributing:
- Write tests for all new functionality
- Update existing tests when modifying behavior
- Ensure all tests pass before submitting
Run tests with coverage:
pytest --cov=clustrix --cov-report=html- Follow PEP 8 style guidelines
- Use type hints for all function parameters and return values
- Write docstrings for all public functions and classes
- Keep functions focused and small
- Use descriptive variable names
- Update docstrings for any modified functions
- Add examples for new features
- Update README.md if adding user-facing features
- Consider adding notebook tutorials for complex features
We use GitHub issue templates to ensure we get all the information needed to address bugs effectively.
To report a bug:
- Go to Issues
- Click "New Issue"
- Select "Bug report" template
- Fill out all sections of the template
The template will guide you to provide:
- Clear description of the bug
- Steps to reproduce the issue
- Expected vs actual behavior
- Environment details and configuration
- Full error messages and tracebacks
We love hearing ideas for new features! To ensure we understand your vision:
- Go to Issues
- Click "New Issue"
- Select "Feature request" template
- Complete all sections
The template helps you describe:
- The feature and its purpose
- Use cases and benefits
- Proposed implementation approach
- Alternative solutions considered
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the development workflow
-
Add tests for your changes
-
Update documentation as needed
-
Commit your changes:
git commit -m "Add feature: brief description" -
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- One feature per PR - keep changes focused
- Write clear commit messages describing what and why
- Include tests for all new functionality
- Update documentation for user-facing changes
- Ensure CI passes before requesting review
- Respond to feedback promptly and constructively
clustrix/
├── clustrix/ # Main package
│ ├── __init__.py # Package exports
│ ├── config.py # Configuration management
│ ├── decorator.py # @cluster decorator
│ ├── executor.py # Remote cluster execution
│ ├── local_executor.py # Local parallel execution
│ ├── loop_analysis.py # Loop detection and analysis
│ ├── cli.py # Command-line interface
│ └── utils.py # Utility functions
├── tests/ # Test suite
├── docs/ # Documentation
├── examples/ # Example scripts
└── setup.py # Package configuration
We particularly welcome contributions in these areas:
We encourage well-defined and clearly scoped requests for additional functionality. When submitting a feature request:
- Use our feature request template
- Provide clear use cases and expected behavior
- Consider how it fits with existing functionality
- Think about backwards compatibility
Examples of features we'd love to see:
- Additional cluster types - Support for other HPC schedulers
- Advanced monitoring - Real-time job monitoring and resource usage
- Workflow management - Support for complex job dependencies
- Integration plugins - IDE extensions, workflow tools, etc.
Help us improve reliability by reporting bugs you encounter. When filing a bug report:
- Use our bug report template
- Include detailed steps to reproduce the issue
- Provide full error messages and tracebacks
- Share your environment details and configuration
Great documentation is crucial for adoption and usability. We need help with:
- Clarifying confusing sections - Identify and improve unclear explanations
- Updating outdated content - Keep examples and guides current
- Adding missing information - Fill gaps in API documentation
- Creating tutorials - Step-by-step guides for common use cases
- Improving examples - More diverse, real-world examples
Specific documentation needs:
- Better explanation of error messages and troubleshooting
- More examples of advanced configurations
- Guides for specific cluster environments
- Performance tuning recommendations
def example_function(param1: str, param2: int = 10) -> bool:
"""
Brief description of what the function does.
Args:
param1: Description of parameter 1
param2: Description of parameter 2 with default value
Returns:
Description of return value
Raises:
ValueError: When param1 is empty
ConnectionError: When cluster is unreachable
Example:
>>> result = example_function("test", 20)
>>> print(result)
True
"""- Use specific exception types rather than generic Exception
- Log errors appropriately (debug, info, warning, error)
- Provide helpful error messages with context
- Clean up resources in finally blocks or context managers
- Test both success and failure cases
- Use mocks for external dependencies (SSH, file system)
- Test edge cases and boundary conditions
- Keep tests independent - no shared state between tests
- Use descriptive test names that explain what is being tested
When contributing:
- Never commit secrets or credentials
- Validate user inputs to prevent injection attacks
- Use safe evaluation instead of
eval()orexec() - Follow security best practices for SSH and remote execution
- Review dependencies for known vulnerabilities
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Code review - We provide constructive feedback on all PRs
Contributors will be:
- Listed in CONTRIBUTORS.md
- Mentioned in release notes for significant contributions
- Credited in documentation where appropriate
Thank you for contributing to Clustrix!