great-docs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. great_docs-0.1.0/LICENSE +21 -0
  2. great_docs-0.1.0/MANIFEST.in +4 -0
  3. great_docs-0.1.0/PKG-INFO +171 -0
  4. great_docs-0.1.0/README.md +100 -0
  5. great_docs-0.1.0/great_docs/__init__.py +21 -0
  6. great_docs-0.1.0/great_docs/_directives.py +164 -0
  7. great_docs-0.1.0/great_docs/_qrenderer/__init__.py +53 -0
  8. great_docs-0.1.0/great_docs/_qrenderer/_ast.py +321 -0
  9. great_docs-0.1.0/great_docs/_qrenderer/_format.py +340 -0
  10. great_docs-0.1.0/great_docs/_qrenderer/_globals.py +35 -0
  11. great_docs-0.1.0/great_docs/_qrenderer/_griffe/__init__.py +28 -0
  12. great_docs-0.1.0/great_docs/_qrenderer/_griffe/dataclasses.py +31 -0
  13. great_docs-0.1.0/great_docs/_qrenderer/_griffe/docstrings.py +74 -0
  14. great_docs-0.1.0/great_docs/_qrenderer/_griffe/enumerations.py +18 -0
  15. great_docs-0.1.0/great_docs/_qrenderer/_griffe/expressions.py +44 -0
  16. great_docs-0.1.0/great_docs/_qrenderer/_md_renderer.py +1001 -0
  17. great_docs-0.1.0/great_docs/_qrenderer/_render/__init__.py +70 -0
  18. great_docs-0.1.0/great_docs/_qrenderer/_render/_label.py +146 -0
  19. great_docs-0.1.0/great_docs/_qrenderer/_render/api_page.py +104 -0
  20. great_docs-0.1.0/great_docs/_qrenderer/_render/base.py +170 -0
  21. great_docs-0.1.0/great_docs/_qrenderer/_render/doc.py +579 -0
  22. great_docs-0.1.0/great_docs/_qrenderer/_render/docattribute.py +75 -0
  23. great_docs-0.1.0/great_docs/_qrenderer/_render/docclass.py +131 -0
  24. great_docs-0.1.0/great_docs/_qrenderer/_render/docfunction.py +33 -0
  25. great_docs-0.1.0/great_docs/_qrenderer/_render/docmodule.py +44 -0
  26. great_docs-0.1.0/great_docs/_qrenderer/_render/extending.py +296 -0
  27. great_docs-0.1.0/great_docs/_qrenderer/_render/mixin_call.py +293 -0
  28. great_docs-0.1.0/great_docs/_qrenderer/_render/mixin_members.py +404 -0
  29. great_docs-0.1.0/great_docs/_qrenderer/_render/mixin_page.py +26 -0
  30. great_docs-0.1.0/great_docs/_qrenderer/_render/reference_page.py +83 -0
  31. great_docs-0.1.0/great_docs/_qrenderer/_render/reference_section.py +123 -0
  32. great_docs-0.1.0/great_docs/_qrenderer/_renderer.py +54 -0
  33. great_docs-0.1.0/great_docs/_qrenderer/_rst_converters.py +930 -0
  34. great_docs-0.1.0/great_docs/_qrenderer/_tools.py +94 -0
  35. great_docs-0.1.0/great_docs/_qrenderer/_transformers.py +132 -0
  36. great_docs-0.1.0/great_docs/_qrenderer/_type_checks.py +139 -0
  37. great_docs-0.1.0/great_docs/_qrenderer/blueprint.py +500 -0
  38. great_docs-0.1.0/great_docs/_qrenderer/introspection.py +660 -0
  39. great_docs-0.1.0/great_docs/_qrenderer/inventory.py +124 -0
  40. great_docs-0.1.0/great_docs/_qrenderer/layout.py +366 -0
  41. great_docs-0.1.0/great_docs/_qrenderer/pandoc/__init__.py +3 -0
  42. great_docs-0.1.0/great_docs/_qrenderer/pandoc/blocks.py +348 -0
  43. great_docs-0.1.0/great_docs/_qrenderer/pandoc/components.py +58 -0
  44. great_docs-0.1.0/great_docs/_qrenderer/pandoc/inlines.py +233 -0
  45. great_docs-0.1.0/great_docs/_qrenderer/py.typed +0 -0
  46. great_docs-0.1.0/great_docs/_qrenderer/typing.py +63 -0
  47. great_docs-0.1.0/great_docs/_qrenderer/typing_information.py +174 -0
  48. great_docs-0.1.0/great_docs/assets/.gitignore +36 -0
  49. great_docs-0.1.0/great_docs/assets/_renderer.py +5 -0
  50. great_docs-0.1.0/great_docs/assets/announcement-banner.js +120 -0
  51. great_docs-0.1.0/great_docs/assets/content-style.js +45 -0
  52. great_docs-0.1.0/great_docs/assets/copy-page.js +126 -0
  53. great_docs-0.1.0/great_docs/assets/dark-mode-toggle.js +305 -0
  54. great_docs-0.1.0/great_docs/assets/github-widget.js +313 -0
  55. great_docs-0.1.0/great_docs/assets/github-workflow-template.yml +100 -0
  56. great_docs-0.1.0/great_docs/assets/great-docs.scss +3894 -0
  57. great_docs-0.1.0/great_docs/assets/navbar-style.js +185 -0
  58. great_docs-0.1.0/great_docs/assets/post-render.py +3044 -0
  59. great_docs-0.1.0/great_docs/assets/reference-switcher.js +110 -0
  60. great_docs-0.1.0/great_docs/assets/ror-icon.svg +9 -0
  61. great_docs-0.1.0/great_docs/assets/sidebar-filter.js +295 -0
  62. great_docs-0.1.0/great_docs/assets/sidebar-wrap.js +162 -0
  63. great_docs-0.1.0/great_docs/assets/theme-init.js +50 -0
  64. great_docs-0.1.0/great_docs/cli.py +933 -0
  65. great_docs-0.1.0/great_docs/config.py +1020 -0
  66. great_docs-0.1.0/great_docs/contrast.py +345 -0
  67. great_docs-0.1.0/great_docs/core.py +11182 -0
  68. great_docs-0.1.0/great_docs.egg-info/PKG-INFO +171 -0
  69. great_docs-0.1.0/great_docs.egg-info/SOURCES.txt +83 -0
  70. great_docs-0.1.0/great_docs.egg-info/dependency_links.txt +1 -0
  71. great_docs-0.1.0/great_docs.egg-info/entry_points.txt +2 -0
  72. great_docs-0.1.0/great_docs.egg-info/requires.txt +24 -0
  73. great_docs-0.1.0/great_docs.egg-info/top_level.txt +1 -0
  74. great_docs-0.1.0/pyproject.toml +195 -0
  75. great_docs-0.1.0/setup.cfg +4 -0
  76. great_docs-0.1.0/tests/test_config.py +678 -0
  77. great_docs-0.1.0/tests/test_contrast.py +213 -0
  78. great_docs-0.1.0/tests/test_directives.py +323 -0
  79. great_docs-0.1.0/tests/test_gdg_rendered.py +6132 -0
  80. great_docs-0.1.0/tests/test_great_docs.py +40314 -0
  81. great_docs-0.1.0/tests/test_integration.py +172 -0
  82. great_docs-0.1.0/tests/test_link_checker.py +1428 -0
  83. great_docs-0.1.0/tests/test_post_render.py +814 -0
  84. great_docs-0.1.0/tests/test_spell_checker.py +757 -0
  85. great_docs-0.1.0/tests/test_synthetic.py +1076 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Posit Software, PBC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include great_docs/assets *
4
+ include great_docs/assets/.gitignore
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.4
2
+ Name: great-docs
3
+ Version: 0.1.0
4
+ Summary: An easy-to-use documentation site generator for Python packages
5
+ Author-email: Rich Iannone <riannone@me.com>
6
+ Maintainer-email: Rich Iannone <riannone@me.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Posit Software, PBC
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://github.com/posit-dev/great-docs
30
+ Project-URL: Repository, https://github.com/posit-dev/great-docs
31
+ Project-URL: Documentation, https://posit-dev.github.io/great-docs/
32
+ Project-URL: Bug Tracker, https://github.com/posit-dev/great-docs/issues
33
+ Keywords: documentation,documentation-generator,api-documentation,quarto,python
34
+ Classifier: Development Status :: 4 - Beta
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Documentation
43
+ Classifier: Topic :: Software Development :: Documentation
44
+ Classifier: Topic :: Text Processing :: Markup :: HTML
45
+ Requires-Python: >=3.11
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: jupyter>=1.1.1
49
+ Requires-Dist: py-yaml12>=0.1.0
50
+ Requires-Dist: click>=8.0.0
51
+ Requires-Dist: griffe<2.0.0,>=0.35.0
52
+ Requires-Dist: pygments>=2.0.0
53
+ Requires-Dist: requests>=2.25.0
54
+ Requires-Dist: pyspellchecker>=0.7.0
55
+ Requires-Dist: tabulate>=0.9.0
56
+ Requires-Dist: Pillow>=9.0.0
57
+ Requires-Dist: cairosvg>=2.5.0
58
+ Requires-Dist: ruff>=0.9.9
59
+ Provides-Extra: dev
60
+ Requires-Dist: pytest>=6.0; extra == "dev"
61
+ Requires-Dist: pytest-cov>=3.0; extra == "dev"
62
+ Requires-Dist: pytest-xdist>=3.5; extra == "dev"
63
+ Requires-Dist: ruff>=0.9.9; extra == "dev"
64
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
65
+ Requires-Dist: pyright>=1.1.407; extra == "dev"
66
+ Requires-Dist: build>=0.7; extra == "dev"
67
+ Requires-Dist: twine>=3.4; extra == "dev"
68
+ Provides-Extra: docs
69
+ Requires-Dist: jupyter>=1.0.0; extra == "docs"
70
+ Dynamic: license-file
71
+
72
+ # Great Docs
73
+
74
+ [![Python versions](https://img.shields.io/pypi/pyversions/great-docs.svg)](https://pypi.org/project/great-docs/)
75
+ [![PyPI](https://img.shields.io/pypi/v/great-docs?logo=python&logoColor=white&color=orange)](https://pypi.org/project/great-docs/)
76
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/great-docs)](https://pypistats.org/packages/great-docs)
77
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://choosealicense.com/licenses/mit/)
78
+ [![CI Build](https://github.com/posit-dev/great-docs/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/posit-dev/great-docs/actions/workflows/test.yml)
79
+ [![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
80
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)
81
+
82
+ Great Docs automatically creates professional documentation with auto-generated API references, CLI documentation, smart navigation, and modern styling.
83
+
84
+ ## Features
85
+
86
+ - **One-command setup** — `great-docs init` creates your entire docs site
87
+ - **Auto-generated API docs** — discovers and documents your package's public API
88
+ - **Docstring detection** — automatically detects NumPy, Google, or Sphinx style
89
+ - **CLI documentation** — generates reference pages for Click-based CLIs
90
+ - **Smart organization** — intelligent class/method/function categorization
91
+ - **User Guide support** — write narrative documentation alongside API reference
92
+ - **Source links** — automatic links to source code on GitHub
93
+ - **LLM-friendly** — auto-generates `llms.txt` and `llms-full.txt` for AI documentation indexing
94
+ - **GitHub Pages ready** — one command sets up deployment workflow
95
+
96
+ ## Quick Start
97
+
98
+ ### Install
99
+
100
+ Great Docs is not yet available on PyPI, so, install from GitHub:
101
+
102
+ ```bash
103
+ pip install git+https://github.com/posit-dev/great-docs.git
104
+ ```
105
+
106
+ ### Initialize
107
+
108
+ Navigate to your Python project and run:
109
+
110
+ ```bash
111
+ great-docs init
112
+ ```
113
+
114
+ This auto-detects your package and creates a `great-docs.yml` configuration file with your API structure.
115
+
116
+ ### Build
117
+
118
+ ```bash
119
+ great-docs build
120
+ ```
121
+
122
+ This creates the `great-docs/` directory with all assets and builds your site to `great-docs/_site/`.
123
+
124
+ ### Preview
125
+
126
+ ```bash
127
+ great-docs preview
128
+ ```
129
+
130
+ Opens the built site in your browser.
131
+
132
+ ### Deploy
133
+
134
+ ```bash
135
+ great-docs setup-github-pages
136
+ ```
137
+
138
+ Creates a GitHub Actions workflow for automatic deployment.
139
+
140
+ ## What You Get
141
+
142
+ - **Landing page** from your README with a metadata sidebar (authors, license, links)
143
+ - **API reference** with classes, functions, and methods organized and styled
144
+ - **CLI reference** with `--help` output in terminal style
145
+ - **User Guide** from your `user_guide/` directory
146
+ - **Source links** to GitHub for every documented item
147
+ - **Mobile-friendly** responsive design
148
+
149
+ ## Documentation
150
+
151
+ The User Guide covers:
152
+
153
+ - [Installation](https://posit-dev.github.io/great-docs/user-guide/installation.html)
154
+ - [Quick Start](https://posit-dev.github.io/great-docs/user-guide/quickstart.html)
155
+ - [Configuration](https://posit-dev.github.io/great-docs/user-guide/configuration.html)
156
+ - [Theming & Appearance](https://posit-dev.github.io/great-docs/user-guide/theming.html)
157
+ - [Cross-Referencing](https://posit-dev.github.io/great-docs/user-guide/cross-referencing.html)
158
+ - [API Documentation](https://posit-dev.github.io/great-docs/user-guide/api-documentation.html)
159
+ - [CLI Documentation](https://posit-dev.github.io/great-docs/user-guide/cli-documentation.html)
160
+ - [User Guides](https://posit-dev.github.io/great-docs/user-guide/user-guides.html)
161
+ - [Custom Sections](https://posit-dev.github.io/great-docs/user-guide/custom-sections.html)
162
+ - [Blog](https://posit-dev.github.io/great-docs/user-guide/blog.html)
163
+ - [Building & Previewing](https://posit-dev.github.io/great-docs/user-guide/building.html)
164
+ - [Deployment](https://posit-dev.github.io/great-docs/user-guide/deployment.html)
165
+ - [Link Checker](https://posit-dev.github.io/great-docs/user-guide/link-checker.html)
166
+ - [Spell Checking](https://posit-dev.github.io/great-docs/user-guide/spell-checker.html)
167
+ - [Changelog](https://posit-dev.github.io/great-docs/user-guide/changelog.html)
168
+
169
+ ## License
170
+
171
+ MIT License. See [LICENSE](https://posit-dev.github.io/great-docs/license.html) for details.
@@ -0,0 +1,100 @@
1
+ # Great Docs
2
+
3
+ [![Python versions](https://img.shields.io/pypi/pyversions/great-docs.svg)](https://pypi.org/project/great-docs/)
4
+ [![PyPI](https://img.shields.io/pypi/v/great-docs?logo=python&logoColor=white&color=orange)](https://pypi.org/project/great-docs/)
5
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/great-docs)](https://pypistats.org/packages/great-docs)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://choosealicense.com/licenses/mit/)
7
+ [![CI Build](https://github.com/posit-dev/great-docs/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/posit-dev/great-docs/actions/workflows/test.yml)
8
+ [![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
9
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)
10
+
11
+ Great Docs automatically creates professional documentation with auto-generated API references, CLI documentation, smart navigation, and modern styling.
12
+
13
+ ## Features
14
+
15
+ - **One-command setup** — `great-docs init` creates your entire docs site
16
+ - **Auto-generated API docs** — discovers and documents your package's public API
17
+ - **Docstring detection** — automatically detects NumPy, Google, or Sphinx style
18
+ - **CLI documentation** — generates reference pages for Click-based CLIs
19
+ - **Smart organization** — intelligent class/method/function categorization
20
+ - **User Guide support** — write narrative documentation alongside API reference
21
+ - **Source links** — automatic links to source code on GitHub
22
+ - **LLM-friendly** — auto-generates `llms.txt` and `llms-full.txt` for AI documentation indexing
23
+ - **GitHub Pages ready** — one command sets up deployment workflow
24
+
25
+ ## Quick Start
26
+
27
+ ### Install
28
+
29
+ Great Docs is not yet available on PyPI, so, install from GitHub:
30
+
31
+ ```bash
32
+ pip install git+https://github.com/posit-dev/great-docs.git
33
+ ```
34
+
35
+ ### Initialize
36
+
37
+ Navigate to your Python project and run:
38
+
39
+ ```bash
40
+ great-docs init
41
+ ```
42
+
43
+ This auto-detects your package and creates a `great-docs.yml` configuration file with your API structure.
44
+
45
+ ### Build
46
+
47
+ ```bash
48
+ great-docs build
49
+ ```
50
+
51
+ This creates the `great-docs/` directory with all assets and builds your site to `great-docs/_site/`.
52
+
53
+ ### Preview
54
+
55
+ ```bash
56
+ great-docs preview
57
+ ```
58
+
59
+ Opens the built site in your browser.
60
+
61
+ ### Deploy
62
+
63
+ ```bash
64
+ great-docs setup-github-pages
65
+ ```
66
+
67
+ Creates a GitHub Actions workflow for automatic deployment.
68
+
69
+ ## What You Get
70
+
71
+ - **Landing page** from your README with a metadata sidebar (authors, license, links)
72
+ - **API reference** with classes, functions, and methods organized and styled
73
+ - **CLI reference** with `--help` output in terminal style
74
+ - **User Guide** from your `user_guide/` directory
75
+ - **Source links** to GitHub for every documented item
76
+ - **Mobile-friendly** responsive design
77
+
78
+ ## Documentation
79
+
80
+ The User Guide covers:
81
+
82
+ - [Installation](https://posit-dev.github.io/great-docs/user-guide/installation.html)
83
+ - [Quick Start](https://posit-dev.github.io/great-docs/user-guide/quickstart.html)
84
+ - [Configuration](https://posit-dev.github.io/great-docs/user-guide/configuration.html)
85
+ - [Theming & Appearance](https://posit-dev.github.io/great-docs/user-guide/theming.html)
86
+ - [Cross-Referencing](https://posit-dev.github.io/great-docs/user-guide/cross-referencing.html)
87
+ - [API Documentation](https://posit-dev.github.io/great-docs/user-guide/api-documentation.html)
88
+ - [CLI Documentation](https://posit-dev.github.io/great-docs/user-guide/cli-documentation.html)
89
+ - [User Guides](https://posit-dev.github.io/great-docs/user-guide/user-guides.html)
90
+ - [Custom Sections](https://posit-dev.github.io/great-docs/user-guide/custom-sections.html)
91
+ - [Blog](https://posit-dev.github.io/great-docs/user-guide/blog.html)
92
+ - [Building & Previewing](https://posit-dev.github.io/great-docs/user-guide/building.html)
93
+ - [Deployment](https://posit-dev.github.io/great-docs/user-guide/deployment.html)
94
+ - [Link Checker](https://posit-dev.github.io/great-docs/user-guide/link-checker.html)
95
+ - [Spell Checking](https://posit-dev.github.io/great-docs/user-guide/spell-checker.html)
96
+ - [Changelog](https://posit-dev.github.io/great-docs/user-guide/changelog.html)
97
+
98
+ ## License
99
+
100
+ MIT License. See [LICENSE](https://posit-dev.github.io/great-docs/license.html) for details.
@@ -0,0 +1,21 @@
1
+ try:
2
+ from importlib.metadata import PackageNotFoundError, version
3
+ except ImportError: # pragma: no cover
4
+ from importlib_metadata import PackageNotFoundError, version # type: ignore[import-not-found]
5
+
6
+ try: # pragma: no cover
7
+ __version__ = version("great-docs")
8
+ except PackageNotFoundError: # pragma: no cover
9
+ __version__ = "0.0.0"
10
+
11
+ from .cli import main
12
+ from .config import Config, create_default_config, load_config
13
+ from .core import GreatDocs
14
+
15
+ __all__ = [
16
+ "Config",
17
+ "GreatDocs",
18
+ "create_default_config",
19
+ "load_config",
20
+ "main",
21
+ ]
@@ -0,0 +1,164 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from dataclasses import dataclass, field
5
+
6
+
7
+ @dataclass
8
+ class DocDirectives:
9
+ """
10
+ Extracted directives from a docstring.
11
+
12
+ Attributes
13
+ ----------
14
+ seealso
15
+ List of `(name, description)` tuples for cross-referencing. The description is an empty
16
+ string when not provided.
17
+ nodoc
18
+ If `True`, exclude this item from documentation.
19
+ """
20
+
21
+ seealso: list[tuple[str, str]] = field(default_factory=list)
22
+ nodoc: bool = False
23
+
24
+ def __bool__(self) -> bool:
25
+ """Return True if any directive was found."""
26
+ return bool(self.seealso or self.nodoc)
27
+
28
+
29
+ # Single-line directive patterns (with % prefix, no colon)
30
+ # Each pattern matches a complete line starting with the directive
31
+ DIRECTIVE_PATTERNS = {
32
+ "seealso": re.compile(r"^\s*%seealso\s+(.+?)\s*$", re.MULTILINE),
33
+ "nodoc": re.compile(r"^\s*%nodoc(?:\s+(true|yes|1))?\s*$", re.MULTILINE | re.IGNORECASE),
34
+ }
35
+
36
+ # Combined pattern for stripping all directives (matches the whole line including newline)
37
+ ALL_DIRECTIVES_PATTERN = re.compile(
38
+ r"^\s*%(?:seealso|nodoc)(?:\s+.*)?$\n?", re.MULTILINE | re.IGNORECASE
39
+ )
40
+
41
+
42
+ def extract_directives(docstring: str | None) -> DocDirectives:
43
+ """
44
+ Extract Great Docs directives from a docstring.
45
+
46
+ Parameters
47
+ ----------
48
+ docstring
49
+ The docstring to parse. Can be None.
50
+
51
+ Returns
52
+ -------
53
+ DocDirectives
54
+ A dataclass containing extracted directive values.
55
+
56
+ Examples
57
+ --------
58
+ >>> doc = '''
59
+ ... Short description.
60
+ ...
61
+ ... %seealso func_a, func_b
62
+ ...
63
+ ... Parameters
64
+ ... ----------
65
+ ... x : int
66
+ ... '''
67
+ >>> directives = extract_directives(doc)
68
+ >>> directives.seealso
69
+ [('func_a', ''), ('func_b', '')]
70
+ """
71
+ directives = DocDirectives()
72
+
73
+ if not docstring:
74
+ return directives
75
+
76
+ # Extract %seealso (comma-separated list, each entry may have ": description")
77
+ if match := DIRECTIVE_PATTERNS["seealso"].search(docstring):
78
+ items: list[tuple[str, str]] = []
79
+ for entry in match.group(1).split(","):
80
+ entry = entry.strip()
81
+ if not entry:
82
+ continue
83
+ # Split on first " : " or ": " to get name and optional description
84
+ parts = re.split(r"\s*:\s*", entry, maxsplit=1)
85
+ name = parts[0].strip()
86
+ desc = parts[1].strip() if len(parts) > 1 else ""
87
+ if name:
88
+ items.append((name, desc))
89
+ directives.seealso = items
90
+
91
+ # Extract %nodoc
92
+ if DIRECTIVE_PATTERNS["nodoc"].search(docstring):
93
+ directives.nodoc = True
94
+
95
+ return directives
96
+
97
+
98
+ def strip_directives(docstring: str | None) -> str:
99
+ """
100
+ Remove all Great Docs directives from a docstring.
101
+
102
+ This produces a clean docstring for rendering in documentation,
103
+ while the original docstring with directives remains in source
104
+ code for IDE display.
105
+
106
+ Parameters
107
+ ----------
108
+ docstring
109
+ The docstring to clean. Can be None.
110
+
111
+ Returns
112
+ -------
113
+ str
114
+ The docstring with all %directive lines removed.
115
+
116
+ Examples
117
+ --------
118
+ >>> doc = '''
119
+ ... Short description.
120
+ ...
121
+ ... %seealso func_a
122
+ ...
123
+ ... Parameters
124
+ ... ----------
125
+ ... x : int
126
+ ... '''
127
+ >>> print(strip_directives(doc))
128
+ Short description.
129
+ <BLANKLINE>
130
+ Parameters
131
+ ----------
132
+ x : int
133
+ """
134
+ if not docstring:
135
+ return docstring or ""
136
+
137
+ # Remove all directive lines
138
+ cleaned = ALL_DIRECTIVES_PATTERN.sub("", docstring)
139
+
140
+ # Clean up resulting multiple blank lines (more than 2 newlines -> 2 newlines)
141
+ cleaned = re.sub(r"\n{3,}", "\n\n", cleaned)
142
+
143
+ # Strip leading/trailing whitespace but preserve internal structure
144
+ return cleaned.strip()
145
+
146
+
147
+ def has_directives(docstring: str | None) -> bool:
148
+ """
149
+ Check if a docstring contains any Great Docs directives.
150
+
151
+ Parameters
152
+ ----------
153
+ docstring
154
+ The docstring to check.
155
+
156
+ Returns
157
+ -------
158
+ bool
159
+ True if any %directive pattern is found.
160
+ """
161
+ if not docstring:
162
+ return False
163
+
164
+ return bool(ALL_DIRECTIVES_PATTERN.search(docstring))
@@ -0,0 +1,53 @@
1
+ from ._md_renderer import MdRenderer
2
+ from ._render.api_page import RenderAPIPage
3
+ from ._render.doc import RenderDoc
4
+ from ._render.docattribute import RenderDocAttribute
5
+ from ._render.docclass import RenderDocClass
6
+ from ._render.docfunction import RenderDocFunction
7
+ from ._render.docmodule import RenderDocModule
8
+ from ._render.extending import (
9
+ exclude_attributes,
10
+ exclude_classes,
11
+ exclude_functions,
12
+ exclude_parameters,
13
+ )
14
+ from ._render.mixin_call import RenderDocCallMixin
15
+ from ._render.mixin_members import RenderDocMembersMixin
16
+ from ._render.reference_page import RenderReferencePage
17
+ from ._render.reference_section import RenderReferenceSection
18
+ from ._renderer import Renderer
19
+ from .blueprint import blueprint, collect, strip_package_name
20
+
21
+ # Re-exports from consolidated _renderer module
22
+ from .introspection import Builder, get_object
23
+ from .inventory import convert_inventory, create_inventory
24
+ from .layout import Auto, Layout
25
+
26
+ __all__ = (
27
+ "Renderer",
28
+ "RenderDoc",
29
+ "RenderDocClass",
30
+ "RenderDocFunction",
31
+ "RenderDocAttribute",
32
+ "RenderDocModule",
33
+ "RenderDocCallMixin",
34
+ "RenderDocMembersMixin",
35
+ "RenderReferencePage",
36
+ "RenderAPIPage",
37
+ "RenderReferenceSection",
38
+ "exclude_attributes",
39
+ "exclude_classes",
40
+ "exclude_functions",
41
+ "exclude_parameters",
42
+ # Consolidated from _renderer
43
+ "get_object",
44
+ "Builder",
45
+ "blueprint",
46
+ "strip_package_name",
47
+ "collect",
48
+ "MdRenderer",
49
+ "create_inventory",
50
+ "convert_inventory",
51
+ "Auto",
52
+ "Layout",
53
+ )