Contributing to XC8 Wrapper¶
Thank you for your interest in contributing to the XC8 Wrapper project! This document provides guidelines and information for contributors.
π Quick Start¶
- Fork the repository on GitHub
- Clone your fork locally:
- Set up the development environment:
- Activate the virtual environment:
- Windows:
.venv\Scripts\activate
- Unix/macOS:
source .venv/bin/activate
- Run tests to ensure everything works:
π οΈ Development Workflow¶
Setting Up Your Development Environment¶
We provide several ways to set up your development environment:
-
Automated setup (recommended):
-
Manual setup:
-
Using Makefile (Unix/macOS):
Running Tests¶
We have comprehensive test coverage. Here are the main test commands:
# Run all tests
python -m pytest tests/ -v
# Run tests with coverage
python -m pytest tests/ --cov=xc8_wrapper --cov-report=html
# Run quick tests (exclude slow tests)
python -m pytest tests/ -v -m "not slow"
# Run specific test categories
python -m pytest tests/test_core.py -v # Core functionality
python -m pytest tests/test_cli.py -v # CLI interface
python -m pytest tests/test_integration.py -v # Integration tests
python -m pytest tests/test_performance.py -v # Performance tests
python -m pytest tests/test_compatibility.py -v # Compatibility tests
# Quick test runner
python run_tests.py
Code Quality¶
We maintain high code quality standards:
# Format and lint code
ruff check --fix .
ruff format .
# Type checking
mypy xc8_wrapper --ignore-missing-imports
# Security checks
safety check
bandit -r xc8_wrapper
# Run all quality checks
make dev # or make ci-test
Pre-commit Hooks¶
We use pre-commit hooks to maintain code quality:
# Install hooks (done automatically by setup_dev.py)
pre-commit install
# Run hooks manually
pre-commit run --all-files
# Update hooks
pre-commit autoupdate
π Contribution Guidelines¶
Code Style¶
- Python: Follow PEP 8, enforced by
ruff
- Line length: 88 characters (configured in pyproject.toml)
- Imports: Sorted with
ruff
using import sorting rules - Type hints: Use type hints where appropriate
- Docstrings: Use Google-style docstrings
Testing¶
- Coverage: Maintain at least 78% test coverage
- Test types: Include unit, integration, and performance tests
- Test naming: Use descriptive test names that explain what is being tested
- Mocking: Use
unittest.mock
for external dependencies
Documentation¶
- README: Update if you add new features
- Docstrings: Document all public functions and classes
- Comments: Add comments for complex logic
- Examples: Include usage examples for new features
Commit Messages¶
Use conventional commit format:
Types: - feat
: New feature - fix
: Bug fix - docs
: Documentation changes - style
: Code style changes - refactor
: Code refactoring - test
: Test changes - chore
: Maintenance tasks
Examples:
feat(cli): add support for custom optimization levels
fix(core): handle unicode paths correctly
docs(readme): update installation instructions
test(core): add tests for edge cases
π Bug Reports¶
When reporting bugs, please include:
- Python version and operating system
- XC8 Wrapper version
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Error messages or stack traces
- Minimal code example if applicable
Use the bug report template in GitHub Issues.
π‘ Feature Requests¶
For feature requests, please:
- Check existing issues to avoid duplicates
- Describe the use case and motivation
- Provide examples of how the feature would be used
- Consider implementation if possible
Use the feature request template in GitHub Issues.
π§ Development Guide¶
Project Structure¶
xc8-wrapper/
βββ xc8_wrapper/ # Main package
β βββ __init__.py # Package initialization
β βββ cli.py # Command-line interface
β βββ core.py # Core functionality
βββ tests/ # Test suite
β βββ test_core.py # Core tests
β βββ test_cli.py # CLI tests
β βββ test_integration.py # Integration tests
β βββ test_performance.py # Performance tests
β βββ test_compatibility.py # Compatibility tests
β βββ test_utils.py # Utility tests
βββ .github/workflows/ # GitHub Actions
βββ demo.py # Demo script
βββ setup_dev.py # Development setup
βββ run_tests.py # Test runner
βββ pyproject.toml # Package configuration
βββ README.md # Documentation
Adding New Features¶
-
Create a branch for your feature:
-
Implement the feature following our code style
-
Add tests for your feature:
- Unit tests in appropriate test files
- Integration tests if needed
-
Update existing tests if they're affected
-
Update documentation:
- Add docstrings to new functions/classes
- Update README if needed
-
Add examples to demo.py if appropriate
-
Run all tests and quality checks:
-
Commit your changes with a good commit message
-
Push to your fork and create a pull request
Testing Guidelines¶
- Write tests first (TDD approach preferred)
- Test edge cases and error conditions
- Use descriptive test names
- Mock external dependencies (file system, network, etc.)
- Test across platforms when possible
Performance Considerations¶
- Profile before optimizing
- Add performance tests for critical paths
- Consider memory usage for large operations
- Test with realistic data sizes
π¦ Release Process¶
Releases are handled by maintainers:
- Version bump in
pyproject.toml
- Update changelog (if maintained)
- Create release PR
- Tag release after merge
- GitHub Actions handles building and publishing
π€ Community¶
- Be respectful and constructive
- Help others with questions and issues
- Follow the code of conduct
- Contribute to discussions
π Getting Help¶
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Email: Contact the maintainers directly if needed
π Recognition¶
Contributors are recognized in: - GitHub contributors page - Release notes (for significant contributions) - README acknowledgments (for major features)
π License¶
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to XC8 Wrapper! Your help makes this project better for everyone. π