Thank you for your interest in contributing to pyxcp! This document provides guidelines and information for contributors.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/pyxcp.git cd pyxcp - Install development dependencies:
poetry install --with dev pre-commit install
- Create a branch for your changes:
git checkout -b feature/your-feature-name
pyxcp includes native C++ extensions that need to be compiled:
# Build extensions
python build_ext.py
# On Linux, ensure dependencies are installed first:
sudo apt install build-essential cmake python3-dev pybind11-dev# Run all tests
pytest
# Run specific test file
pytest pyxcp/tests/test_can.py
# Run with coverage
pytest --cov=pyxcp --cov-report=html
# Run single test
pytest pyxcp/tests/test_master.py::TestMaster::testConnectWe use pre-commit hooks to ensure code quality:
# Run all checks manually
pre-commit run --all-files
# Individual tools:
ruff format . # Format code
ruff check . --fix # Lint and auto-fix
bandit -c bandit.yml -r pyxcp/ # Security scan
mypy pyxcp/ # Type checkingCode Style:
- Line length: 132 characters
- Formatter: ruff (replaces black)
- Follow existing patterns in the codebase
- Keep changes focused: One feature or bug fix per PR
- Write tests: Add tests for new features or bug fixes
- Update documentation: Update docs if behavior changes
- Follow conventions: See Key Conventions below
# Stage your changes
git add .
# Commit with descriptive message
git commit -m "Add feature: description
- Detail 1
- Detail 2
Fixes: #123"All commits are automatically checked by pre-commit hooks.
-
Update your branch with latest main:
git fetch upstream git rebase upstream/master
-
Push to your fork:
git push origin feature/your-feature-name
-
Create Pull Request on GitHub:
- Use the PR template
- Reference related issues
- Describe what changed and why
- Add screenshots if relevant
-
Respond to reviews:
- Address feedback promptly
- Push additional commits to the same branch
- Mark conversations as resolved when fixed
-
Merge requirements:
- All tests pass
- Pre-commit hooks pass
- At least one maintainer approval
- No merge conflicts
-
Context Manager for XCP connections:
from pyxcp.cmdline import ArgumentParser ap = ArgumentParser(description="My tool") with ap.run() as x: x.connect() # ... operations x.disconnect()
-
Configuration via Traitlets (not TOML):
from pyxcp.config import get_config c = get_config() c.Transport.layer = 'CAN' c.Transport.Can.interface = 'vector'
-
Transport Layer - inherit from
base.BaseTransport:from pyxcp.transport.base import BaseTransport class MyTransport(BaseTransport): def connect(self): # Implementation pass
-
C++ Extensions:
- Source in
pyxcp/{module}/*.cpp - pybind11 wrapper in
*_wrapper.cpp - Rebuild after changes:
python build_ext.py
- Source in
- Use
pyxcp.transport.mockfor tests without hardware - Tests with hardware should be skippable (check for
PYXCP_TEST_HARDWAREenv var) - DAQ tests use fixtures sparingly (prefer direct instantiation)
- Docstrings: Google style
- Update
docs/if adding features - Add examples to
pyxcp/examples/for significant features - Update FAQ for common issues
Looking for ideas? Check these:
- Implement
REINIT_DAQcommand (issue #208) - Fix CAN filter timing (issue #231)
- Multi-channel CAN support (issue #227)
- Improve DAQ documentation and examples (issue #156, #142)
- Memory leak in DAQ mode (issue #171)
- More tutorial examples
- Video tutorials
- Translation (German, Chinese)
- Troubleshooting guides
- Increase test coverage (currently ~85%)
- Integration tests with real ECUs
- Performance benchmarks
Look for issues labeled good-first-issue on GitHub.
Use the Bug Report template and include:
- pyxcp version
- Python version
- Operating system
- Transport layer (CAN/ETH/USB/Serial)
- Minimal code to reproduce
- Expected vs actual behavior
Use the Feature Request template and describe:
- Problem you're trying to solve
- Proposed solution
- Alternative approaches considered
- Impact/use case
- Issues: Bug reports, feature requests
- Discussions: Questions, ideas, general discussion
- Pull Requests: Code contributions
- Email: christoph2@users.noreply.github.com (for security issues)
Please read and follow our Code of Conduct. We are committed to providing a welcoming and inclusive environment.
By contributing, you agree that your contributions will be licensed under the LGPL v3+ license.
Contributors are listed in CONTRIBUTORS file. Thank you for your contributions!
Check our roadmap for planned features and improvements. Major initiatives are organized into Work Packages:
- WP-1: Build & Deployment Infrastructure
- WP-2: DAQ Implementation
- WP-3: CAN Transport Stability
- WP-4: Configuration System
- WP-5: Error Handling
- WP-6: Memory & Performance
- WP-7: Documentation
- WP-8: Logging
- WP-9: Extended Features
See session roadmap documents for details on each work package.
- FAQ: Check docs/FAQ.md first
- Documentation: See
docs/folder - Examples: See
pyxcp/examples/folder - Discussions: Ask questions in GitHub Discussions
- Issues: Search existing issues for similar problems
Recommended extensions:
- Python
- Pylance
- Ruff
- C/C++ (for native extensions)
- CMake
- Enable poetry integration
- Configure ruff as external tool
- Set line length to 132
# Ubuntu/Debian dependencies
sudo apt install build-essential cmake python3-dev pybind11-dev
# Test build
./test_linux_build.sh- Install Visual Studio Build Tools
- Select "Desktop development with C++"
- Restart terminal after install
Thank you for contributing to pyxcp! 🚀
For questions or guidance, open a Discussion or reach out to maintainers.