Thank you for your interest in contributing to XBridge! We welcome contributions from the community.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Code Style Guidelines
- Testing
- Documentation
- Submitting Changes
- Reporting Bugs
- Suggesting Enhancements
This project adheres to a Code of Conduct that all contributors are expected to follow. Please read CODE_OF_CONDUCT.md before contributing.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/xbridge.git cd xbridge - Add the upstream repository:
git remote add upstream https://github.com/Meaningful-Data/xbridge.git
- Python 3.9 or higher
- Poetry (for dependency management)
- 7z command-line tool (for taxonomy loading)
-
Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 - -
Install project dependencies:
poetry install
-
Activate the virtual environment:
poetry shell
We use Ruff for linting and formatting, and MyPy for type checking. While we don't have automated pre-commit hooks, you should run these before committing:
# Run Ruff linting
ruff check src/xbridge tests/
# Run Ruff formatting
ruff format src/xbridge tests/
# Run MyPy type checking
mypy src/xbridgeWe welcome many types of contributions:
- Bug fixes
- New features
- Documentation improvements
- Performance improvements
- Test coverage improvements
- Code refactoring
- Translation improvements
- Check existing issues: Before starting work, check if there's already an issue for what you want to do
- Create an issue: If no issue exists, create one to discuss your proposed changes
- Create a branch: Create a feature branch from
maingit checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix - Make your changes: Implement your changes following our code style guidelines
- Test your changes: Ensure all tests pass and add new tests if needed
- Commit your changes: Write clear, descriptive commit messages
- Push to your fork: Push your changes to your GitHub fork
- Submit a pull request: Open a PR against the
mainbranch
We follow these standards:
- PEP 8: Python Enhancement Proposal 8 style guide
- Ruff: For linting and formatting (configuration in
pyproject.toml) - MyPy: For static type checking with strict mode enabled
- Type hints: All functions should have type annotations
- Line length: Maximum 100 characters
- Docstrings: All public modules, functions, classes, and methods should have docstrings
- Type hints: Required for all function signatures
- Complexity: Maximum McCabe complexity of 20
from typing import Optional
from pathlib import Path
def example_function(
input_path: Path,
output_path: Optional[Path] = None,
validate: bool = True,
) -> bool:
"""
Brief description of what this function does.
:param input_path: Description of input_path parameter
:param output_path: Description of output_path parameter
:param validate: Description of validate parameter
:return: Description of return value
"""
# Implementation
passRun the test suite using pytest:
# Run all tests
pytest
# Run with coverage report
pytest --cov=xbridge --cov-report=html
# Run specific test file
pytest tests/test_specific.py
# Run with verbose output
pytest -v- All new features should include tests
- Bug fixes should include regression tests
- Aim for high test coverage (we strive for >80%)
- Use descriptive test names that explain what is being tested
- Follow the Arrange-Act-Assert pattern
Example test:
def test_convert_instance_creates_output_file(tmp_path):
"""Test that convert_instance creates an output file."""
# Arrange
input_path = "tests/data/sample_instance.xml"
output_path = tmp_path / "output"
# Act
result = convert_instance(input_path, output_path)
# Assert
assert result.exists()
assert result.suffix == ".zip"- Use reStructuredText (.rst) format for documentation
- Follow Sphinx documentation conventions
- Include docstrings for all public APIs
- Update relevant documentation when changing functionality
cd docs
sphinx-build -b html . _buildThe documentation will be available in docs/_build/index.html.
- API Documentation: Auto-generated from docstrings
- Tutorials: Step-by-step guides for common tasks
- How-to Guides: Solutions to specific problems
- Technical Notes: Deep dives into architecture and design
- Update documentation: Ensure documentation is updated for any changed functionality
- Update CHANGELOG: Add an entry to the "Unreleased" section of CHANGELOG.md
- Ensure tests pass: All tests must pass before PR can be merged
- Code review: At least one maintainer must review and approve your PR
- CI checks: All CI checks (testing, linting, type checking) must pass
- Title: Use a clear, descriptive title
- Description: Explain what changes you made and why
- Link issues: Reference any related issues (e.g., "Fixes #123")
- Small PRs: Keep PRs focused on a single concern when possible
- Commits: Use clear commit messages following conventional commits format
We follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(converter): add support for DORA CSV conversion
fix(instance): handle None values in decimals field
docs(readme): update installation instructions
- Check the issue tracker for existing reports
- Try to reproduce with the latest version
- Gather relevant information (error messages, input files, etc.)
- Description: Clear description of the bug
- Steps to reproduce: Minimal steps to reproduce the issue
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Environment: Python version, OS, XBridge version
- Error messages: Full error messages and stack traces
- Sample data: If possible, provide sample input files (without sensitive data)
We welcome feature suggestions! When suggesting an enhancement:
- Check existing issues: See if someone else has suggested it
- Provide context: Explain the use case and why it's valuable
- Describe the solution: How you envision the feature working
- Consider alternatives: What other approaches might work?
If you have questions about contributing:
- Open a GitHub Discussion
- Email us at info@meaningfuldata.eu
- Check our documentation
By contributing to XBridge, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to XBridge!