API reference
This reference is generated from the public Documentledger modules, including the CLI, storage and scan layers, section/source indexing, impact resolution, context rendering, and link management.
- documentledger.source_index.function_signature(node: FunctionDef | AsyncFunctionDef) str[source]
- documentledger.source_index.docstring_value(node: Module | ClassDef | FunctionDef | AsyncFunctionDef) str[source]
- documentledger.source_index.decorator_hash(node: FunctionDef | AsyncFunctionDef | ClassDef) str[source]
- documentledger.source_index.function_unit(path: str, lines: list[str], node: FunctionDef | AsyncFunctionDef, qualname: str) SourceUnit[source]
- documentledger.source_index.class_unit(path: str, lines: list[str], node: ClassDef) SourceUnit[source]
- documentledger.source_index.module_unit(path: str, lines: list[str], tree: Module) SourceUnit[source]
- documentledger.source_index.file_unit(path: str, text: str, line_count: int) SourceUnit[source]
- documentledger.source_index.index_python_source(path: str, text: str) list[SourceUnit][source]
- documentledger.source_index.source_units_for_file(path: Path, repo_path: str) list[SourceUnit][source]
- documentledger.source_index.source_inventory(root: Path, source_paths: list[str]) dict[str, dict[str, Any]][source]
- documentledger.source_index.source_inventory_for_paths(root: Path, source_paths: Sequence[str]) dict[str, dict[str, Any]][source]
- class documentledger.models.Config(root: 'Path', path: 'Path', project_name: 'str', project_uuid: 'str', storage_dir: 'Path', source_roots: 'list[str]', doc_roots: 'list[str]', source_extensions: 'list[str]', doc_extensions: 'list[str]', validation_commands: 'list[str]', require_doc_frontmatter: 'bool' = False)[source]
- root: Path
- path: Path
- project_name: str
- project_uuid: str
- storage_dir: Path
- require_doc_frontmatter: bool = False
- class documentledger.models.ToolConfig(config_version: int, ledger_code: str, source_roots: tuple[str, ...], doc_roots: tuple[str, ...], source_extensions: tuple[str, ...], doc_extensions: tuple[str, ...], validation_commands: tuple[str, ...], require_doc_frontmatter: bool = False)[source]
Documentledger’s tool-owned schema-2 configuration.
Project identity and storage routing deliberately do not live here. They are supplied by the shared ledgercore manifest and resolved layout.
- config_version: int
- ledger_code: str
- require_doc_frontmatter: bool
- class documentledger.models.WorkspacePaths(project_root: Path, manifest_path: Path | None, local_config_path: Path | None, config_path: Path, data_dir: Path, artifacts_dir: Path | None, config_binding_path: Path | None, data_binding_path: Path | None, artifacts_binding_path: Path | None, layout_source: Literal['canonical', 'legacy'])[source]
Resolved canonical or legacy paths, kept separate from tool config.
- project_root: Path
- config_path: Path
- data_dir: Path
- layout_source: Literal['canonical', 'legacy']
- property storage_dir: Path
Compatibility alias for storage call sites during the migration.
- __init__(project_root: Path, manifest_path: Path | None, local_config_path: Path | None, config_path: Path, data_dir: Path, artifacts_dir: Path | None, config_binding_path: Path | None, data_binding_path: Path | None, artifacts_binding_path: Path | None, layout_source: Literal['canonical', 'legacy']) None
- class documentledger.models.Workspace(config: 'Config', metadata: 'dict[str, object]', paths: 'WorkspacePaths | None' = None, project_name: 'str | None' = None, project_uuid: 'str | None' = None)[source]
- config: Config
- paths: WorkspacePaths | None = None
- class documentledger.models.SourceUnit(source_id: 'str', path: 'str', kind: 'str', qualname: 'str', line_span: 'tuple[int, int]', signature: 'str', hashes: 'dict[str, str]')[source]
- source_id: str
- path: str
- kind: str
- qualname: str
- signature: str
- class documentledger.models.DocSection(section_id: 'str', doc_path: 'str', heading_path: 'list[str]', heading_slug: 'str', line_span: 'tuple[int, int]', section_hash: 'str', summary: 'str', text: 'str')[source]
- section_id: str
- doc_path: str
- heading_slug: str
- section_hash: str
- summary: str
- text: str
- class documentledger.models.ScanResult(version: 'int', changed_sources: 'list[str]' = <factory>, deleted_sources: 'list[str]' = <factory>, stale_docs: 'list[str]' = <factory>, unlinked_changed_sources: 'list[str]' = <factory>, changed_units: 'list[dict[str, Any]]'=<factory>, added_units: 'list[dict[str, Any]]'=<factory>, deleted_units: 'list[dict[str, Any]]'=<factory>, affected_sections: 'list[dict[str, Any]]'=<factory>, unmapped_changed_units: 'list[dict[str, Any]]'=<factory>, source_units: 'dict[str, dict[str, Any]]'=<factory>, source_hashes: 'dict[str, str]'=<factory>, doc_hashes: 'dict[str, str]'=<factory>, unchanged: 'bool' = False)[source]
- version: int
- unchanged: bool = False
- __init__(version: int, changed_sources: list[str] = <factory>, deleted_sources: list[str] = <factory>, stale_docs: list[str] = <factory>, unlinked_changed_sources: list[str] = <factory>, changed_units: list[dict[str, ~typing.Any]]=<factory>, added_units: list[dict[str, ~typing.Any]]=<factory>, deleted_units: list[dict[str, ~typing.Any]]=<factory>, affected_sections: list[dict[str, ~typing.Any]]=<factory>, unmapped_changed_units: list[dict[str, ~typing.Any]]=<factory>, source_units: dict[str, dict[str, ~typing.Any]]=<factory>, source_hashes: dict[str, str]=<factory>, doc_hashes: dict[str, str]=<factory>, unchanged: bool = False) None