Metadata-Version: 2.4
Name: douki
Version: 0.14.1
Summary: Documetatio from annotations
License: BSD 3 Clause
License-File: LICENSE
Author: Ivan Ogasawara
Author-email: ivan.ogasawara@gmail.com
Requires-Python: >=3.10,<4
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: atpublic (>=5,<6)
Requires-Dist: jsonschema (>=4)
Requires-Dist: plum-dispatch (>=2.5,<3)
Requires-Dist: pyyaml (>=6)
Requires-Dist: rich (>=13)
Requires-Dist: tomli (>=2.0.0) ; python_version < "3.11"
Requires-Dist: typeguard (>=4.4,<5)
Requires-Dist: typer (>=0.9)
Description-Content-Type: text/markdown

# Douki

**YAML docstrings with types supplied by annotations.**

Write descriptions in your docstrings and types in Python annotations.
Douki enriches documentation when you inspect it, while its CLI validates
and formats the YAML in your source files.

```python
def add(a: int, b: int = 0) -> int:
    """
    title: Add two integers.
    parameters:
      a: First value.
      b: Second value.
    returns: Sum of a and b.
    """
    return a + b
```

## Inspect documentation

Register the library once in its `__init__.py`:

```python
# mylib/__init__.py
import douki

douki.register(__name__)
```

Users then call ordinary Python help:

```python
import mylib

help(mylib.add)  # Douki descriptions enriched with annotation types
help(len)        # Regular Python help
```

Registration covers the package and its submodules, including future imports.
Objects defined in other libraries retain regular help, even when re-exported
by your package. No per-function decorators or user activation calls are needed.
The shared help wrapper routes by defining package; importing Douki alone does
not install it. Original `__doc__` strings remain authored text.

Tools can call `douki.getdoc(add)` directly without registration to obtain
enriched YAML. Documentation generators can also use the static enrichment API.

## Synchronize, format and validate source

```bash
pip install douki

douki sync src/            # Add missing descriptions
douki format src/          # Normalize YAML formatting
douki format --check src/  # Preview formatting differences
douki check src/           # Validate documentation
```

`check` and `sync` require annotations for parameters, return values and
documented attributes. Use `-> None` for functions without a result;
implicit method receivers are exempt. Authored `type` fields are rejected
by the schema. Remove only those fields from existing docstrings and put
types in annotations instead. Keep `parameters`, `returns` and `attributes`
with their descriptions: annotations supply types, not explanations.

`sync` adds missing parameter, attribute and return entries with `...`
placeholders, without storing types. It preserves existing descriptions
and reports stale parameter names. `format` only changes presentation;
`check` reports missing or incomplete descriptions.
Dynamic inspection raises `DocumentationError` for missing annotations.

The CLI can remain a development dependency. Install Douki in the running
interpreter when using `getdoc`, `help` or library registration.

Documentation generators can use the public `enrich`, `Signature` and
`Parameter` API with statically collected types, without importing the
project being documented. See the [usage guide](usage.md).

Douki respects `.gitignore` by default. Override it with
`--no-respect-gitignore` or `[tool.douki] respect-gitignore = false`.

- [Installation](installation.md)
- [Usage guide](usage.md)
- [Performance benchmarks](performance.md)
- [Changelog](changelog.md)
- [Contributing](contributing.md)

