Contributing
April 16, 2026 · View on GitHub
Thank you for your interest in contributing to QPanda3 Runtime MCP Server!
Getting Started
Prerequisites
- Python 3.10 or higher
- Git
- uv (recommended) or pip
Fork and Clone
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/qpanda3-runtime-mcp-server.git
cd qpanda3-runtime-mcp-server
- Install development dependencies:
uv sync --all-extras
Development Setup
Code Style
We use the following tools for code quality:
- Ruff for linting and formatting
- mypy for type checking
# Format code
uv run ruff format .
# Lint code
uv run ruff check .
# Type check
uv run mypy src/
Pre-commit Hooks
Install pre-commit hooks:
uv run pre-commit install
Making Changes
Branch Naming
feature/your-featurefor new featuresfix/your-fixfor bug fixesdocs/your-docsfor documentation changes
Commit Messages
Follow conventional commits:
feat: add new featurefix: resolve bugdocs: update documentationtest: add testsrefactor: improve code structure
Testing
Test Categories
| Category | Location | Description |
|---|---|---|
| Unit Tests | tests/ | Individual function/class tests with mocks |
| E2E Tests | tests/e2e/ | End-to-end MCP protocol and workflow tests |
| Integration | tests/ | Tests with external services (requires credentials) |
Running Tests
# Run all tests
uv run pytest
# Run with coverage (target: 80%+)
uv run pytest --cov=src --cov-report=html
# Run specific test file
uv run pytest tests/test_server.py
# Run E2E tests only
uv run pytest tests/e2e/ -v
# Run with markers
uv run pytest -m e2e -v # E2E tests
uv run pytest -m "not e2e" -v # Unit tests only
Writing Tests
- Place unit tests in the
tests/directory - Place E2E tests in the
tests/e2e/directory - Use pytest fixtures from
conftest.py - Aim for 80%+ test coverage
- Follow TDD: write tests first, then implement
For detailed E2E testing guide, see E2E Testing.
Documentation
Building Documentation
This project uses MkDocs with the Material theme for documentation.
# Install documentation dependencies
uv sync --extra docs
# Build documentation (English + Chinese)
./scripts/build-docs.sh
# Local preview (with language switching)
mkdocs serve
Documentation Structure
docs/ # English documentation (default)
docs/zh/ # Chinese documentation
mkdocs.yml # MkDocs configuration with i18n plugin
Adding New Documentation Pages
- Create the page as a Markdown file in
docs/(English) - Create the corresponding Chinese version in
docs/zh/ - Add it to the
navsection inmkdocs.yml - Add the Chinese nav label in
nav_translations.zhinmkdocs.yml - For untranslated Chinese pages, copy the English version with a "not yet translated" banner:
!!! warning
此页面尚未翻译。[English version](../../page.md).
(English content follows)
Documentation Style
- Use Markdown (
.md) for all documentation - API reference is auto-generated from docstrings using mkdocstrings
- Include code examples where helpful
- Use MkDocs Material admonitions for notes and warnings
Pull Request Process
- Create a feature branch from
main - Make your changes
- Add tests for new functionality
- Update documentation
- Run all tests and linting
- Submit a pull request
PR Checklist
- Code follows project style guidelines
- All tests pass
- New code has appropriate test coverage
- Documentation is updated
- Commit messages follow conventions
Code of Conduct
Please be respectful and inclusive in all interactions.
License
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.