Contributing¶
We welcome contributions to httptap! This guide will help you get started.
Code of Conduct¶
Please note that this project follows the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
Getting Started¶
Prerequisites¶
- Python 3.11 or higher (CPython)
- uv package manager
- Git
Setting Up Development Environment¶
- Fork and clone the repository:
- Install dependencies:
- Verify installation:
Development Workflow¶
Running Tests¶
Run the full test suite:
Run with coverage:
View coverage report:
Code Quality¶
Linting¶
Run Ruff linter:
Auto-fix issues:
Formatting¶
Check formatting:
Auto-format code:
Type Checking¶
Run mypy:
Running Benchmarks¶
Performance benchmarks use pytest-codspeed and run automatically in CI:
# Run benchmarks locally (validates correctness, no performance data)
uv run pytest tests/test_benchmarks.py --codspeed
# Measure wall-clock time locally, with a results table
uv run pytest tests/test_benchmarks.py --codspeed --codspeed-mode=walltime
# Run benchmarks without CodSpeed (as regular tests)
uv run pytest tests/test_benchmarks.py
Benchmarks cover pure-computation functions across models, formatters, utils, and exporter modules. CI measures CPU instructions (simulation) and memory allocations (memory).
Use --codspeed-mode=walltime to check an optimization locally without waiting for CI; it takes roughly two seconds per benchmark. Wall-clock numbers are inherently noisy on shared hardware, so CI relies on simulation instead — treat local walltime results as a directional signal, not as the value CI will report.
Running the End-to-End Tests¶
The suite in tests/e2e runs the httptap CLI as a subprocess against local HTTP, TLS, proxy, SOCKS5 and OTLP servers. A plain uv run pytest does not collect it; pass the directory explicitly:
# Against the source checkout (the otel extra is needed for the OTLP tests)
uv run --extra otel pytest tests/e2e --no-cov -n auto
# Against another build, such as an installed wheel
uv run pytest tests/e2e --no-cov -n auto --httptap /path/to/venv/bin/httptap
CI runs it against the built wheel and the container image, and the daily E2E matrix workflow repeats it on Linux, macOS and Windows with Python 3.11, 3.13, 3.14, 3.14t, 3.15 and 3.15t. See tests/e2e/README.md for running it against a Docker image and for all options.
Running Locally¶
Test your changes:
Or install in editable mode:
Making Changes¶
Branch Naming¶
Use descriptive branch names:
feature/add-http2-support- New featuresfix/tls-timeout-issue- Bug fixesdocs/update-api-reference- Documentationrefactor/extract-parser- Code refactoring
Commit Messages¶
Follow conventional commits format:
Types:
feat- New featurefix- Bug fixdocs- Documentation changesrefactor- Code refactoringtest- Adding/updating testschore- Maintenance tasksperf- Performance improvements
Examples:
feat(cli): add --timeout flag for request timeout
Add command-line option to specify custom timeout for HTTP requests.
Defaults to 20 seconds if not specified.
Closes #123
fix(tls): handle certificate expiry edge case
Fix crash when certificate expiry date is in the past.
Now properly reports negative days and warns user.
Fixes #456
Code Style¶
Follow the Google Python Style Guide:
- Use type hints for all function signatures
- Write docstrings for all public APIs
- Keep lines under 120 characters
- Use double quotes for strings
- Follow PEP 8 naming conventions
Example:
def resolve_hostname(host: str, timeout: float = 5.0) -> tuple[str, str]:
"""Resolve hostname to IP address.
Args:
host: Hostname to resolve.
timeout: Maximum time to wait in seconds.
Returns:
Tuple of (ip_address, family).
Raises:
DNSError: If resolution fails.
"""
pass
Testing Guidelines¶
- Write tests for all new features
- Maintain or improve code coverage
- Use descriptive test names
- Mock external dependencies (DNS, TLS, HTTP)
- Test both success and failure cases
Example:
def test_analyzer_follows_redirects(mock_http_client):
"""Test that analyzer follows redirect chains correctly."""
analyzer = HTTPTapAnalyzer(follow_redirects=True)
steps = analyzer.analyze_url("https://httpbin.io/redirect/3")
assert len(steps) == 4 # Initial + 3 redirects
assert steps[-1].response.status == 200
Pull Request Process¶
- Create a feature branch:
- Make your changes and commit:
- Push to your fork:
-
Create a Pull Request:
- Go to the httptap repository
- Click "New Pull Request"
- Select your branch
- Fill out the PR template
PR Checklist¶
Before submitting, ensure:
- Tests pass (
uv run pytest) - Code is formatted (
uv run ruff format .) - Linter passes (
uv run ruff check) - Type checks pass (
uv run mypy httptap) - Documentation is updated (if needed)
- Commit messages follow conventional format (
CHANGELOG.mdis generated from them by git-cliff at release time; do not edit it by hand)
Documentation¶
Updating Docs¶
Documentation is in the docs/ directory:
Build docs locally:
View at: http://127.0.0.1:8000
Documentation Standards¶
- Use clear, concise language
- Include code examples
- Keep examples realistic and practical
- Use proper Markdown formatting
- Test all code examples
Areas for Contribution¶
Good First Issues¶
Look for issues labeled good first issue - these are beginner-friendly.
Help Wanted¶
Issues labeled help wanted are priorities we'd love assistance with.
Ideas for Contributions¶
These follow the in-scope themes of the roadmap, which also lists the non-goals (load testing, non-HTTP protocols such as WebSocket or gRPC, a GUI/TUI, a plugin loader):
- Timing accuracy - Refinements to trace hooks and the fallback estimates
- More export formats - Further machine-readable exporters driven by a concrete need (Prometheus and OpenTelemetry export already ship)
- SLO extensions - Relative budgets against a baseline, soft vs hard SLOs
- More TLS details - OCSP, certificate chain analysis
- HTTP/3 support - Once stable Python support lands upstream
- Documentation - Worked examples, troubleshooting recipes, integration cookbooks
Getting Help¶
- GitHub Issues - Bug reports and feature requests
- Discussions - Questions and general discussion
- Discord - Real-time chat (coming soon)
Recognition¶
Contributors are recognized in:
- CHANGELOG.md
- GitHub Contributors page
- Release notes
Thank you for contributing to httptap! 🎉