docs.collection

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Docs collection — load, index, and query documentation pages.

DocsCollectionis the central data structure. It loads markdown files from disk, renders them once viaMarkdownRenderer, and stores frozenDocPageinstances…

Docs collection — load, index, and query documentation pages.

DocsCollectionis the central data structure. It loads markdown files from disk, renders them once viaMarkdownRenderer, and stores frozenDocPageinstances in memory. After construction the collection is immutable and thread-safe.

Usage::

from chirp.docs import DocsCollection

collection = DocsCollection.load(Path("content/docs"))
page = collection.get("getting-started")

docs.collection

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

DocsCollection
class

Immutable collection of documentation pages.

Constructed via theload()class method which eagerly reads and renders all markdown files at startup. After construction every public method is a pure read — no I/O, no locks.

Design decisions:

* **Eager load** — all content rendered at startup so request-
  time cost is a dict lookup + template render.  For 100 docs
  at ~50 KB each this is ~5 MB of memory, well within budget.
* **Single directory** — constructor takes one ``Path``.
  Multiple directories can be merged via ``merge()``.
* **Keyword search** — simple ranked keyword matching over
  title + raw markdown.  No external dependencies.  Can be
  upgraded to trigram/BM25 later without API change.

View source · /home/runner/work/chirp/chirp/site/../src/chirp/docs/collection.py:1