Thank you for your interest in contributing! This document provides guidelines and information for contributors.
- Python 3.12 or higher
- Git
# 1. Clone the repository
git clone https://github.com/polprog-tech/CodeMap.git
cd CodeMap
# 2. (Recommended) Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# 3. Install in editable mode with dev dependencies
pip install -e ".[dev]"
# 4. Verify the installation
codemap --help
pytest# All tests
pytest
# With verbose output
pytest -v
# With coverage
pytest --cov=codemap --cov-report=term-missing
# Specific test file or class
pytest tests/test_rendering.py
pytest tests/test_rendering.py::TestHtmlRendererruff check src/ tests/
ruff format --check src/ tests/
# Auto-fix
ruff check --fix src/ tests/
ruff format src/ tests/mypy src/ruff check src/ tests/ && ruff format --check src/ tests/ && mypy src/ && pytestcodemap scan examples/python_project
codemap graph examples/python_project --no-git
codemap report examples/python_project --no-gitPlease read docs/architecture.md before making changes. Key principles:
- Domain layer (
src/codemap/domain/) has zero external dependencies - Application layer orchestrates but does not import infrastructure directly at module level
- Infrastructure layer implements domain contracts (Protocols)
- CLI layer is a thin adapter between user input and application use cases
| What | Where |
|---|---|
| New model/value object | domain/model.py |
| New metric | domain/metrics.py |
| New language extractor | infrastructure/extractors/ |
| New output format | rendering/ |
| New CLI command | cli/commands/ |
| New use case | application/ |
- Create a new file in
infrastructure/extractors/(e.g.,rust_extractor.py) - Implement the
DependencyExtractorprotocol fromdomain/model.py - Register in
analyzer.py's extractor mapping - Write tests in
tests/
- Create a new renderer in
rendering/implementingGraphRenderer - Register in
grapher.py's format mapping - Add CLI flag in
cli/commands/graph.pyif needed - Write tests
- Fork the repository and create a feature branch from
main - Make your changes following the architecture guidelines
- Add tests for new functionality
- Ensure all tests pass:
pytest - Ensure linting passes:
ruff check src/ tests/ - Update documentation if needed
- Submit a pull request using the PR template
Use conventional commit style:
feat: add Rust dependency extractor
fix: handle circular imports gracefully
test: add edge case tests for large-graph clustering
docs: update architecture diagram
refactor: extract common analysis logic
- Full type hints on all function signatures
- Docstrings on public classes and functions
- Use
from __future__ import annotationsin all modules - All UI strings go through the
T(key)I18N function with bothenandplentries - All CSS colors use
var(--name)custom properties for theme support - Follow existing patterns in the codebase
- Let
ruffhandle formatting
Use the GitHub issue templates:
- Bug reports — include reproduction steps, expected vs actual behavior, and environment details
- Feature requests — describe the problem, proposed solution, and alternatives considered
By contributing, you agree that your contributions will be licensed under the same license as the project (MIT).