# Extension points — TheAlgorithms/Python

> Canonical page: https://codevetter.com/unpack/python/extension-points

# Extension points — TheAlgorithms/Python

Scanned commit 52b9b913e08ea5afe81e82c1f502887c049750ba (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The extension model is 'add a file': drop a snake_case .py module into an existing topic directory, give every function doctests + type hints + a reference URL, and CI/pytest auto-discovers it via --doctest-modules with zero registration. Project Euler has a stricter contract (problem_NNN dirs, solN.py files, one solution() entrypoint, an answers-JSON entry). Generated surfaces (DIRECTORY.md, Sphinx autoapi, coverage) pick up new files automatically; new top-level directories additionally require updating docs/conf.py autoapi_dirs. Optional dependency groups (cv, quantum, euler-validate, docs, test) are the seam for heavy new deps.
- Auto-discovery is the plugin mechanism: pytest --doctest-modules plus os.walk-based good_file_paths() mean a new .py file in any existing directory is tested and indexed with no registry edits. — [pyproject.toml#L217-222](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/pyproject.toml#L217-L222) [scripts/build_directory_md.py#L7-18](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/scripts/build_directory_md.py#L7-L18)
- New top-level directories DO require manual registration: docs/conf.py's autoapi_dirs is a hardcoded list of 43 dirs, and CONTRIBUTING.md says avoid creating new directories anyway. — [docs/conf.py#L24-68](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/docs/conf.py#L24-L68) [CONTRIBUTING.md#L212](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/CONTRIBUTING.md#L212)
- Project Euler extension contract: create project_euler/problem_<NNN>/__init__.py + sol1.py (etc.) exposing solution() whose defaults yield the answer; module docstring must link the problem; answers are enforced by scripts/project_euler_answers.json. — [project_euler/README.md#L19-50](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/project_euler/README.md#L19-L50) [scripts/validate_solutions.py#L98-108](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/scripts/validate_solutions.py#L98-L108) [project_euler/problem_001/sol1.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/project_euler/problem_001/sol1.py)
- Per-domain tests/ subdirectories are the pattern for adding real pytest coverage beyond doctests (hashing/tests/, kd_tree/tests/, graphs/tests/, knapsack/tests/), discovered automatically by pytest. — [data_structures/hashing/tests/test_hash_map.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/data_structures/hashing/tests/test_hash_map.py) [graphs/tests/test_min_spanning_tree_kruskal.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/graphs/tests/test_min_spanning_tree_kruskal.py) [knapsack/tests/test_knapsack.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/knapsack/tests/test_knapsack.py)
- New third-party dependencies extend via pyproject.toml dependencies or an optional [dependency-groups] section; the uv-lock pre-commit hook regenerates uv.lock, and heavy/GIL-bound deps should follow the cv/quantum optional-group precedent plus a build.yml --ignore entry. — [pyproject.toml#L13-64](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/pyproject.toml#L13-L64) [.pre-commit-config.yaml#L57-60](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.pre-commit-config.yaml#L57-L60) [.github/workflows/build.yml#L42-58](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/workflows/build.yml#L42-L58) [CONTRIBUTING.md#L205](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/CONTRIBUTING.md#L205)
- PEP-723 inline script metadata (`# /// script`) is the lightweight seam for standalone runnable files needing extra deps without touching pyproject — used by web_programming scrapers and validate_solutions.py. — [web_programming/current_stock_price.py#L1-7](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/web_programming/current_stock_price.py#L1-L7) [scripts/validate_solutions.py#L3-9](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/scripts/validate_solutions.py#L3-L9)
- Ruff per-file-ignores in pyproject.toml are the sanctioned escape hatch when a new file legitimately violates a rule (existing entries for BLE001, SIM115, SIM103). — [pyproject.toml#L156-176](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/pyproject.toml#L156-L176)
- Pre-commit local hooks are the extension point for new repo-wide checks — validate-filenames is a `repo: local` hook entry-pointing to scripts/validate_filenames.py; new validators can be added the same way. — [.pre-commit-config.yaml#L49-55](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.pre-commit-config.yaml#L49-L55) [scripts/validate_filenames.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/scripts/validate_filenames.py)
- Reusable Comparable Protocol + TypeVar pattern in sorts/bubble_sort.py is the house generic-typing idiom for container algorithms; new sorts should reuse it to satisfy the shared tests/test_sorts.py battery contract (return sorted list, comparable items). — [sorts/bubble_sort.py#L4-11](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/sorts/bubble_sort.py#L4-L11) [tests/test_sorts.py#L1-17](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/tests/test_sorts.py#L1-L17)
- Maintainer automation extends via scripts/ + workflows: hacktoberfest_prep_update.py shows the pattern (httpx2 AsyncClient, GITHUB_TOKEN, TRACKER file rewrite, rolling-branch PR) reusable for new bots. — [scripts/hacktoberfest_prep_update.py#L1-59](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/scripts/hacktoberfest_prep_update.py#L1-L59) [.github/workflows/hacktoberfest_prep.yml#L70-105](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/workflows/hacktoberfest_prep.yml#L70-L105)
- GitHub Skills under .github/skills/ (code-review, new-pull-request, review-open-issue SKILL.md files) encode agent-facing contribution procedures — the repo's own extension surface for AI agents. — [.github/skills/code-review/SKILL.md](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/skills/code-review/SKILL.md) [.github/skills/new-pull-request/SKILL.md](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/skills/new-pull-request/SKILL.md) [.github/skills/review-open-issue/SKILL.md](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/skills/review-open-issue/SKILL.md)
- The one-algorithm-per-PR rule plus 'identical implementations not allowed' in CONTRIBUTING.md defines the feature-addition boundary: variants of an existing algorithm must differ meaningfully (complexity, representation), matching the sol1..solN pattern in project_euler. — [CONTRIBUTING.md#L18](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/CONTRIBUTING.md#L18) [.github/pull_request_template.md#L13](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/.github/pull_request_template.md#L13) [project_euler/problem_001/sol1.py](https://github.com/TheAlgorithms/Python/blob/52b9b913e08ea5afe81e82c1f502887c049750ba/project_euler/problem_001/sol1.py)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
