-
Notifications
You must be signed in to change notification settings - Fork 5
Contributing
Herve Hildenbrand edited this page Jan 20, 2026
·
1 revision
Thank you for your interest in contributing to BGP Explorer!
git clone https://github.com/hervehildenbrand/bgp-explorer.git
cd bgp-explorer# Install all dependencies including dev tools
uv sync --dev
# Install external tools
uv run bgp-explorer install-depscp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=bgp_explorer
# Run specific test file
uv run pytest tests/test_models/test_route.py -v
# Run specific test
uv run pytest tests/test_models/test_route.py::test_function_name -vWe use Ruff for linting and formatting.
uv run ruff check src/ tests/uv run ruff check --fix src/ tests/uv run ruff format --check src/ tests/uv run ruff format src/ tests/Before pushing changes:
# 1. Run tests
uv run pytest
# 2. Run linter
uv run ruff check src/ tests/
# 3. Check formatting
uv run ruff format --check src/ tests/The CI pipeline runs both pytest and ruff on every push.
Click "Fork" on GitHub to create your own copy.
git checkout -b feature/your-feature-name- Write code following the existing style
- Add tests for new functionality
- Update documentation if needed
uv run pytest
uv run ruff check src/ tests/Use clear, descriptive commit messages:
git commit -m "feat: Add support for new data source"
git commit -m "fix: Handle empty API responses gracefully"
git commit -m "docs: Update installation instructions"git push origin feature/your-feature-nameThen open a Pull Request on GitHub.
Use type hints for all functions:
async def get_prefix_info(self, prefix: str) -> dict[str, Any]:
"""Get routing information for a prefix.
Args:
prefix: IP prefix in CIDR notation.
Returns:
Dictionary with routing information.
"""
...Use Google-style docstrings:
def analyze_path(self, routes: list[BGPRoute]) -> dict[str, Any]:
"""Analyze AS paths from a list of routes.
Args:
routes: List of BGPRoute objects to analyze.
Returns:
Dictionary containing:
- unique_paths: Number of unique paths
- avg_length: Average path length
- upstream_asns: Set of upstream ASNs
Raises:
ValueError: If routes list is empty.
"""
...Handle errors gracefully:
try:
result = await self._ripe_stat.get_bgp_state(prefix)
except Exception as e:
return f"Error looking up prefix: {str(e)}"To add a new tool for Claude:
- Add the method to
BGPToolsinsrc/bgp_explorer/ai/tools.py - Include detailed docstring (Claude reads this)
- Add to
get_all_tools()if conditionally available - Add status message to
TOOL_DESCRIPTIONS - Write tests in
tests/
src/bgp_explorer/
├── ai/tools.py # Add new tools here
├── sources/ # Add new data sources here
├── analysis/ # Add analysis utilities here
├── models/ # Add data models here
└── ...
tests/
├── test_models/ # Model tests
├── test_sources/ # Data source tests
├── test_analysis/ # Analysis tests
└── ...
Use GitHub Issues for:
- Bug reports (include reproduction steps)
- Feature requests
- Documentation improvements
Include:
- Python version
- OS and version
- Error messages
- Steps to reproduce
- Check existing issues on GitHub
- Read the documentation in this wiki
- Open a discussion on GitHub
By contributing, you agree that your contributions will be licensed under the MIT License.