Debian Codegraph @

tests/apps/complex-demo/README.md

raw symbols SCIP
1 # Complex Demo Application
2
3 A comprehensive test application for cyclopts documentation plugins. This application
4 covers all known edge cases for documentation generation with both MkDocs and Sphinx.
5
6 ## Features Tested
7
8 ### Type System
9 - **Dataclass parameter flattening** - `@Parameter(name="*")` with frozen and mutable dataclasses
10 - **Nested dataclasses** - Dataclass containing other dataclasses
11 - **Pydantic models** - BaseModel subclasses (if pydantic installed)
12 - **attrs classes** - @attrs.define classes (if attrs installed)
13 - **Complex union types** - `int | Literal["auto"]`, `int | Literal["high", "medium", "low"]`
14 - **Enums and Flags** - Standard enum.Enum and enum.Flag types
15 - **Optional types** - `Path | None = None`
16 - **List types** - `list[str]`, `list[Path]`, `list[OutputFormat]`
17
18 ### Command Structure
19 - **4-level nested apps** - `admin → users → permissions → roles`
20 - **Custom groups** - `Group.create_ordered()` for organized help
21 - **Hidden commands** - Commands with `show=False`
22 - **Hidden parameters** - Parameters with `show=False`
23 - **meta.default pattern** - Global option interceptor
24
25 ### Parameter Features
26 - **Count parameters** - `-v`, `-vv`, `-vvv`
27 - **parse=False parameters** - Config file paths not parsed from CLI
28 - **allow_leading_hyphen** - Token forwarding
29 - **Validators** - `validators.Number()`, `validators.Path()`
30 - **Positional-only** - `/,` separator
31 - **Keyword-only** - `*,` separator
32 - **Aliases** - `-f`/`--force` style aliases
33
34 ### Docstring Formats
35 - NumPy style (default)
36 - Google style
37 - Sphinx/reST style
38
39 ## Directory Structure
40
41 ```
42 complex-demo/
43 ├── complex_app.py # Main application with all edge cases
44 ├── mkdocs.yml # MkDocs configuration
45 ├── mkdocs_docs/ # MkDocs documentation source
46 │ ├── index.md
47 │ └── cli/
48 │ ├── index.md # Full reference with TOC
49 │ ├── admin.md # Nested commands, filtering
50 │ ├── data.md # Dataclass flattening
51 │ ├── server.md # Pydantic models
52 │ ├── utilities.md # Various features
53 │ └── full.md # Flattened + hidden commands
54 ├── docs/source/ # Sphinx documentation source
55 │ ├── conf.py
56 │ ├── index.rst
57 │ └── cli/
58 │ ├── index.rst
59 │ ├── admin.rst
60 │ ├── data.rst
61 │ ├── server.rst
62 │ ├── utilities.rst
63 │ └── full.rst
64 └── pyproject.toml
65 ```
66
67 ## Building Documentation
68
69 ### MkDocs
70
71 ```bash
72 cd tests/apps/complex-demo
73 mkdocs build
74 mkdocs serve # For development
75 ```
76
77 ### Sphinx
78
79 ```bash
80 cd tests/apps/complex-demo
81 sphinx-build -b html docs/source docs/build/html
82 ```
83
84 ## Running Tests
85
86 The e2e tests in `tests/test_docs_e2e.py` exercise this demo application:
87
88 ```bash
89 # Run all e2e documentation tests
90 uv run pytest tests/test_docs_e2e.py -v
91
92 # Run just MkDocs tests
93 uv run pytest tests/test_docs_e2e.py::TestMkDocsBuild -v
94
95 # Run just Sphinx tests
96 uv run pytest tests/test_docs_e2e.py::TestSphinxBuild -v
97 ```
98
99 ## Comparison with darts-nextgen
100
101 This demo replicates patterns found in darts-nextgen:
102
103 | Pattern | darts-nextgen | complex-demo |
104 |---------|---------------|--------------|
105 | `@Parameter(name="*")` on dataclass | ✅ | ✅ |
106 | Frozen dataclasses | ✅ | ✅ |
107 | Nested dataclasses | ✅ | ✅ |
108 | `Group.create_ordered()` | ✅ | ✅ |
109 | `meta.default` interceptor | ✅ | ✅ |
110 | Count parameters (`-v`, `-vv`) | ✅ | ✅ |
111 | `parse=False` parameters | ✅ | ✅ |
112 | 3+ level nesting | ✅ | ✅ (4 levels) |
113 | Complex Literal unions | ✅ | ✅ |
114 | Multiple doc sections with filters | ✅ | ✅ |
115
116 Additional patterns in complex-demo:
117 - Pydantic model support
118 - attrs class support
119 - enum.Flag types
120 - Multiple docstring format examples
121 - Hidden command/parameter testing