Skip to main content

doc-map - YAML map of a Python project

CI

Walk a Python project and emit a YAML manifest of every function and class, paired with the first sentence of its docstring and the line it's defined on. Each file also says what it is for and how big it is.

Why

An AI coding assistant reads a codebase the expensive way. It opens files. A file is mostly implementation, and the assistant pays for all of it, in context window and in attention, to learn three things: what exists, what it claims to do, and where it lives.

doc-map hands over those three things and nothing else. Every function and class signature, the first sentence of its docstring, and its 1-indexed line number, as minimal YAML. A few hundred lines standing in for a few thousand.

After that, reading gets surgical. vim +195 src/example/cli.py drops a human on the exact def. An assistant does the same with a ranged read, instead of pulling the whole file in to find one function. You hand over the map, not the territory.

Wire it into your agent

A map you have to remember to generate is a map you will forget to generate. It earns its keep when the assistant fetches one itself, at the moment it needs one, and agent harnesses that read a SKILL.md will do exactly that once you tell them when.

skills/doc-map/SKILL.md in this repo is that file. Not a specimen written for the README: it is the one in daily use here. Copy the skills/doc-map folder to wherever your harness keeps skills, which for Claude Code means ~/.claude/skills/, and the assistant will start fetching the map on its own. If doc-map is missing, the assistant installs it first.

The description field at the top is the part that matters most. It is what the assistant matches against when deciding whether to reach for the tool, so it names situations, not features. Everything under it is only read once the skill has already been picked. Worth knowing if you plan to write your own for something else.

Example output

src/example/cli.py:
  doc: Walk a project and print its map.
  lines:
    code: 301
    blank: 76
    comments: 22
    docstrings: 90
  entries:
    - def: first_doc_sentence(node)
      doc: Extract the first sentence of a docstring, regardless of line breaks.
      line: 163
    - def: collect_defs(tree, include_private)
      doc: Collect top-level and class-level function/class defs with their docstrings.
      line: 195
total:
  files: 1
  code: 301
  blank: 76
  comments: 22
  docstrings: 90
  • One mapping per file, paths relative to the root, files sorted
  • Each file opens with its own docstring's first sentence and its lines, split into code, blank, comments, and docstrings. A total closes the map
  • Line numbers are 1-indexed, matching what your editor expects
  • Values are quoted only when YAML needs them to be, so the common case stays readable
  • Methods carry dotted qualnames (Foo.bar, Foo.Inner.baz)
  • Nested defs inside function bodies are deliberately not descended into, so the map stays flat and shows the public-ish surface

Install

doc-map requires Python 3.9 or newer and has no runtime dependencies: standard library only. Tested in CI on Python 3.9 through 3.15.

uv tool install doc-map

uv fetches its own Python. Or install it with pipx, which uses the Python already on the machine:

pipx install doc-map

Usage

doc-map print PATH [--include-private] [--include-tests] [--force]
  • PATH is the directory to walk. It comes before the flags, whose order among themselves is free.
  • Bare doc-map prints the usage banner and its help, and doc-map print on its own prints a page about the map. Walking the current directory is an explicit doc-map print .
  • --include-private includes single-underscore names. Dunders are always skipped.
  • --include-tests includes files under test directories and test_*.py
  • --force walks a root that failed the safety sniff (see below)

The map goes to stdout, so a shell redirect writes it to a file:

doc-map print . > map.yaml

doc-map does not read piped input: its unit of work is a directory, not a stream.

What it filters out by default

  • .git, __pycache__, .venv, venv, env, node_modules, .pytest_cache, .mypy_cache, build, dist, .eggs, .tox, .idea, .vscode, and any hidden directory
  • Test files (test_*.py, *_test.py, conftest.py) and directories named test/tests, unless --include-tests is passed
  • Dunder methods (__init__, __repr__, etc.) always; single-underscore names unless --include-private is passed

Safety rails

doc-map refuses to walk a directory that looks like an OS root (a cluster of dirs like bin, etc, usr; an unusually large number of top-level entries; or a filesystem anchor like /). Pass --force if you really mean it.

It also caps out at 5000 .py files mid-walk and aborts loudly, on the assumption that crossing that ceiling means the wrong root got passed in, not that you have a 5000-file Python project. The ceiling is the one thing --force will not lift, since vouching for an odd-looking root is not vouching for unbounded output.

Notes

  • Works on any directory tree of .py files. Files that fail to parse are skipped with a note to stderr, never fatally.
  • The YAML writer is hand-rolled to keep the tool zero-dependency

More documentation

  • Design: the boundary, the decisions, and the reasons
  • Skill: the command line, written for an agent
  • Changelog: project history and releases

Use of AI

Code and documentation are written in collaboration with remote and local AI; design decisions, code review, semantic and auditory review, and final judgement stay human.


East Van AI · AI for the rest of us! · Vancouver, BC, Canada

github.com/east-van-ai · east-van-ai@proton.me

Copyright (c) 2026 Go Nakamaru

Metadata

Release files for doc-map 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doc-map 0.4.1
File Size Uploaded Provenance Actions
doc_map-0.4.1.tar.gz 12.6 kB With provenance Details for doc_map-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for doc-map 0.4.1
File Interpreter ABI Platform Actions
doc_map-0.4.1-py3-none-any.whl Python 3 none any Details for doc_map-0.4.1-py3-none-any.whl

Total release size: 25.7 kB

Release files / doc_map-0.4.1.tar.gz

Download URL doc_map-0.4.1.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e06b42dd4a5b2e9e3cddfcd337522626627d32dc6dc1c4e1adf41d1d105e094b
BLAKE2b-256 checksum
How to use checksums
322887e6f4ae64a71e689867b39baa548cd5e865686e82e45e1a62e0c81e5e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / doc_map-0.4.1-py3-none-any.whl

Download URL doc_map-0.4.1-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c19c7bf68ffa74a43f464aa3eb289ac9070801c6f4c4ca31a895456a0a5791bc
BLAKE2b-256 checksum
How to use checksums
f6540e59b8d6dd95dac8f680e7a383d55327aabe1fabb5b11b3114c31eabeed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for doc-map 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for doc_map-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page