11# Douki
22
3- [ ![ Poetry] ( https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json )] ( https://python-poetry.org/ ) ![ Mkdocs] ( https://img.shields.io/badge/Documentation%20engine-Mkdocs-orange )
4- [ ![ Built with Material for MkDocs] ( https://img.shields.io/badge/Material_for_MkDocs-526CFE?style=for-the-badge&logo=MaterialForMkDocs&logoColor=white )] ( https://squidfunk.github.io/mkdocs-material/ )
5- ![ Conda] ( https://img.shields.io/badge/Virtual%20environment-conda-brightgreen?logo=anaconda ) [ ![ Ruff] ( https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json )] ( https://github.com/astral-sh/ruff ) [ ![ security: bandit] ( https://img.shields.io/badge/security-bandit-yellow.svg )] ( https://github.com/PyCQA/bandit )
6- ![ coverage] ( https://img.shields.io/badge/Code%20coverage%20testing-coverage.py-blue )
7- [ ![ Ruff] ( https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json )] ( https://github.com/astral-sh/ruff )
8- ![ vulture] ( https://img.shields.io/badge/Find%20unused%20code-vulture-blue )
9- ![ McCabe] ( https://img.shields.io/badge/Complexity%20checker-McCabe-blue )
10- ![ mypy] ( https://img.shields.io/badge/Static%20typing-mypy-blue )
11- ![ pytest] ( https://img.shields.io/badge/Testing-pytest-cyan?logo=pytest ) [ ![ pre-commit] ( https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit )] ( https://github.com/pre-commit/pre-commit )
12- ![ Makim] ( https://img.shields.io/badge/Automation%20task-Makim-blue ) ![ GitHub Actions] ( https://img.shields.io/badge/GitHub%20Actions-CI-blue?logo=githubactions )
3+ ** Language-agnostic YAML docstrings for Python.**
134
14- Documetatio from annotations
5+ Douki is a developer tool that uses a structured YAML format inside Python
6+ docstrings. It keeps your docstrings in sync with your function signatures and
7+ validates them against a schema — all without adding a runtime dependency to
8+ your package.
159
16- - Software License: BSD 3 Clause
10+ ## Why Douki?
1711
18- - Documentation: https://osl-incubator.github.io/douki
12+ - ** Structured** — docstrings are YAML, not free-form text. Parameters have
13+ ` type ` , ` description ` , ` optional ` , and ` default ` fields.
14+ - ** Auto-synced** — ` douki sync ` adds new parameters, removes stale ones, and
15+ updates return types automatically.
16+ - ** Validated** — every docstring is checked against a JSON Schema so typos and
17+ invalid fields are caught early.
18+ - ** Dev-only** — Douki is a development tool. It does ** not** need to be a
19+ runtime dependency of your package.
20+ - ** Migratable** — convert existing NumPy-style docstrings with
21+ ` douki sync --migrate numpy ` .
1922
20- ### Douki YAML Format
23+ ## Quick Start
24+
25+ Install Douki as a dev dependency:
26+
27+ ``` bash
28+ pip install douki
29+ ```
30+
31+ Write a docstring in Douki YAML format:
2132
2233``` python
2334def add (a : int , b : int = 0 ) -> int :
@@ -38,56 +49,19 @@ def add(a: int, b: int = 0) -> int:
3849 return a + b
3950```
4051
41- Fields like ` visibility ` (default: ` public ` ), ` mutability ` (default: ` mutable ` ),
42- and ` scope ` (default: ` static ` for functions, ` instance ` for methods) are
43- omitted when they match their Python defaults.
44-
45- ### CLI — ` douki sync ` / ` douki check `
46-
47- Synchronize Douki YAML docstrings with Python function
48- signatures. Designed to run standalone or as a ** pre-commit hook** .
52+ Sync your docstrings with the actual signatures:
4953
5054``` bash
51- # Show what would change (exit 1 if diffs exist)
55+ # Preview changes
5256douki check src/
5357
5458# Apply changes in-place
5559douki sync src/
56-
57- # Specific files
58- douki check path/to/file.py
59- ```
60-
61- Without arguments, both commands default to the current directory.
62-
63- #### Migrating from NumPy docstrings
64-
65- Convert existing NumPy-style docstrings to Douki YAML:
66-
67- ``` bash
68- # Preview what the migration would look like
69- douki check --migrate numpy src/
70-
71- # Apply the migration
72- douki sync --migrate numpy src/
73- ```
74-
75- #### Pre-commit integration
76-
77- ``` yaml
78- # .pre-commit-config.yaml
79- repos :
80- - repo : https://github.com/osl-incubator/douki
81- rev : v0.6.0 # pin to a release tag
82- hooks :
83- - id : douki-check
84- name : douki check
85- entry : douki check
86- language : python
87- types : [python]
8860```
8961
90- ## Credits
62+ ## What's Next?
9163
92- This package was created with
93- [scicookie](https://github.com/osl-incubator/scicookie) project template.
64+ - [ Installation] ( installation.md ) — install via pip, conda, or from source
65+ - [ Usage Guide] ( usage.md ) — CLI commands, YAML schema, and migration
66+ - [ Changelog] ( changelog.md ) — release history
67+ - [ Contributing] ( contributing.md ) — how to contribute
0 commit comments