Thank you for your interest in improving evolver.py! This document covers setup, coding standards, and submission guidelines.
# Clone the repo
git clone https://github.com/EvoMap/evolver.py.git
cd evolver.py
# Install dependencies (requires uv >= 0.5)
uv sync
# Verify installation
uv run evolver --version
# Run tests (CI default: exclude slow)
uv run pytest -m "not slow" -q
# Run all tests including slow
uv run pytest tests/ -q
# Run tests with coverage
uv run pytest tests/ --cov=evolver --cov-report=term-missing
# Run linting
uv run ruff check src tests
# Run type checking (strict, 177 source files)
uv run mypy srcIf you prefer not to use uv:
pip install -e ".[dev,test]"
pytest tests/ -q- Formatter:
ruff format(line width 100) - Linter:
ruff check --fix- Enabled rules:
E, F, W, I, N, UP, B, C4, SIM, ARG, PL, RUF - Intentionally suppressed:
PLR2004(magic values),PLR0913(many arguments inherited from Node API)
- Enabled rules:
- Type checker:
mypy srcwithstrict = true - Python version: 3.12+ syntax required (
from __future__ import annotations,X | None,list[str])
All new code must pass uv run mypy src (strict) before submission. The full ruff check suite may report pre-existing style warnings; fix any issues in files you touch.
Current baseline (2026-06-15): 1331 tests (pytest), mypy 0 errors.
- Write tests for every new module or bug fix.
- Place tests in
tests/with the naming conventiontest_<module>.py. - Use
pytestfixtures andmonkeypatchfor isolation. - Mock external HTTP calls with
respxorresponses. - Use
freezegunfor time-related tests. - Aim for >80% coverage on new code.
- Test files should mirror source structure:
tests/gep/test_asset_store.pytestsevolver.gep.asset_store.
- Always use
monkeypatch.setenvto modify environment variables, neveros.environdirectly. - Use the
temp_workspacefixture fromconftest.pyto isolate path-related tests. - Git-related tests should initialize a fresh git repo:
subprocess.run(["git", "init", "-q"]). - Do not modify
src/evolver/assets/gep/genes.seed.jsonin tests; useGEP_ASSETS_DIRoverride.
- Use conventional commits with an optional scope:
feat(gep):,fix(proxy):,test(atp):,docs:,refactor(ops):,chore: - Keep commits atomic and focused on a single concern.
- Reference related issues or PRs when applicable, e.g.
fix(sanitize): skip path/URL env values (#568). - Format:
<type>(<scope>): <description>— see the Node.js reference repo's history for examples (feat(hooks):,fix(loop):,refactor:). - Releases bump
versioninpyproject.tomlfollowing SemVer and add a## [x.y.z]entry toCHANGELOG.md.scripts/check_changelog.pyenforces consistency.
- Fork the repository and create a feature branch.
- Ensure all tests pass:
uv run pytest tests/ -q - Ensure lint passes:
uv run ruff check src tests - Ensure type check passes:
uv run mypy src - Update documentation if your change affects user-facing behavior (
README.md,AGENTS.md,SKILL.md). - If modifying architecture or adding new modules, update
设计方案.mdandTODO.mdaccordingly. - Open a PR with a clear description of the change and motivation.
When making significant architectural changes, please open a discussion issue first. Key design principles:
- Pythonic: Prefer
pathlib,dataclasses,asyncio, stdlib. - Atomic writes: Use
tmp.write_text(...); tmp.replace(path). - Cross-platform: Avoid shell commands; handle Windows/macOS/Linux differences explicitly.
- Minimal changes: Make the smallest change that achieves the goal.
- Behavior equivalence: When in doubt, check the Node.js reference implementation's tests for the expected behavior.
- Every source file must have a top-level docstring referencing its Node.js equivalent (e.g., "Equivalent to
evolver/src/gep/assetStore.js"). - All public functions must have type annotations.
- Pydantic models should use
ConfigDict(extra="forbid")to reject unknown fields. - Use lazy imports in
cli.pyandguards.pyto avoid loading heavy modules before.envis loaded.
When adding or modifying features, update the relevant documentation:
- User-facing changes →
README.mdandREADME.zh.md - Agent integration changes →
AGENTS.md - Skill/capability changes →
SKILL.md - Architecture changes →
设计方案.md - Gap analysis changes →
TODO.md
- Never commit secrets, tokens, or private keys.
- Use
evolver.gep.sanitizeto redact sensitive data before logging or publishing. - All shell commands must use
subprocess.run([...], shell=False). - Report security vulnerabilities privately to the maintainers.
When contributing to partially implemented subsystems, please be transparent about the scope:
- If implementing a previously missing module, remove it from the "missing" lists in
TODO.mdand update its status in设计方案.md. - If adding a stub or placeholder, mark it clearly with
passand a# TODO:comment referencing the relevant issue or roadmap item. - Do not mark features as "complete" in documentation unless they have corresponding tests.