autodocgenerator 0.9.0.2__tar.gz → 0.9.0.3__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.
- autodocgenerator-0.9.0.3/PKG-INFO +983 -0
- autodocgenerator-0.9.0.3/README.md +903 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/engine/config/config.py +3 -3
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/pyproject.toml +1 -1
- autodocgenerator-0.9.0.2/PKG-INFO +0 -981
- autodocgenerator-0.9.0.2/README.md +0 -901
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/__init__.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/auto_runner/config_reader.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/auto_runner/run_file.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/config/config.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/engine/__init__.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/engine/exceptions.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/engine/models/gpt_model.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/engine/models/model.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/factory/__init__.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/factory/base_factory.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/factory/modules/general_modules.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/factory/modules/intro.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/manage.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/postprocessor/custom_intro.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/postprocessor/sorting.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/preprocessor/code_mix.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/preprocessor/compressor.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/preprocessor/settings.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/preprocessor/spliter.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/ui/__init__.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/ui/logging.py +0 -0
- {autodocgenerator-0.9.0.2 → autodocgenerator-0.9.0.3}/autodocgenerator/ui/progress_base.py +0 -0
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autodocgenerator
|
|
3
|
+
Version: 0.9.0.3
|
|
4
|
+
Summary: This Project helps you to create docs for your projects
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: dima-on
|
|
7
|
+
Author-email: sinica911@gmail.com
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Requires-Dist: CacheControl (==0.14.4)
|
|
16
|
+
Requires-Dist: Pygments (==2.19.2)
|
|
17
|
+
Requires-Dist: RapidFuzz (==3.14.3)
|
|
18
|
+
Requires-Dist: annotated-types (==0.7.0)
|
|
19
|
+
Requires-Dist: anyio (==4.12.1)
|
|
20
|
+
Requires-Dist: certifi (==2026.1.4)
|
|
21
|
+
Requires-Dist: charset-normalizer (==3.4.4)
|
|
22
|
+
Requires-Dist: cleo (==2.1.0)
|
|
23
|
+
Requires-Dist: colorama (==0.4.6)
|
|
24
|
+
Requires-Dist: crashtest (==0.4.1)
|
|
25
|
+
Requires-Dist: distlib (==0.4.0)
|
|
26
|
+
Requires-Dist: distro (==1.9.0)
|
|
27
|
+
Requires-Dist: dulwich (==0.25.2)
|
|
28
|
+
Requires-Dist: fastjsonschema (==2.21.2)
|
|
29
|
+
Requires-Dist: filelock (==3.20.3)
|
|
30
|
+
Requires-Dist: findpython (==0.7.1)
|
|
31
|
+
Requires-Dist: google-auth (==2.47.0)
|
|
32
|
+
Requires-Dist: google-genai (==1.56.0)
|
|
33
|
+
Requires-Dist: groq (==1.0.0)
|
|
34
|
+
Requires-Dist: h11 (==0.16.0)
|
|
35
|
+
Requires-Dist: httpcore (==1.0.9)
|
|
36
|
+
Requires-Dist: httpx (==0.28.1)
|
|
37
|
+
Requires-Dist: idna (==3.11)
|
|
38
|
+
Requires-Dist: installer (==0.7.0)
|
|
39
|
+
Requires-Dist: jaraco.classes (==3.4.0)
|
|
40
|
+
Requires-Dist: jaraco.context (==6.1.0)
|
|
41
|
+
Requires-Dist: jaraco.functools (==4.4.0)
|
|
42
|
+
Requires-Dist: jiter (==0.12.0)
|
|
43
|
+
Requires-Dist: keyring (==25.7.0)
|
|
44
|
+
Requires-Dist: markdown-it-py (==4.0.0)
|
|
45
|
+
Requires-Dist: mdurl (==0.1.2)
|
|
46
|
+
Requires-Dist: more-itertools (==10.8.0)
|
|
47
|
+
Requires-Dist: msgpack (==1.1.2)
|
|
48
|
+
Requires-Dist: openai (==2.14.0)
|
|
49
|
+
Requires-Dist: packaging (==25.0)
|
|
50
|
+
Requires-Dist: pbs-installer (==2026.1.14)
|
|
51
|
+
Requires-Dist: pkginfo (==1.12.1.2)
|
|
52
|
+
Requires-Dist: platformdirs (==4.5.1)
|
|
53
|
+
Requires-Dist: pyasn1 (==0.6.1)
|
|
54
|
+
Requires-Dist: pyasn1_modules (==0.4.2)
|
|
55
|
+
Requires-Dist: pydantic (==2.12.5)
|
|
56
|
+
Requires-Dist: pydantic_core (==2.41.5)
|
|
57
|
+
Requires-Dist: pyproject_hooks (==1.2.0)
|
|
58
|
+
Requires-Dist: python-dotenv (==1.2.1)
|
|
59
|
+
Requires-Dist: pywin32-ctypes (==0.2.3)
|
|
60
|
+
Requires-Dist: pyyaml (==6.0.3)
|
|
61
|
+
Requires-Dist: requests (==2.32.5)
|
|
62
|
+
Requires-Dist: requests-toolbelt (==1.0.0)
|
|
63
|
+
Requires-Dist: rich (==14.2.0)
|
|
64
|
+
Requires-Dist: rich_progress (==0.4.0)
|
|
65
|
+
Requires-Dist: rsa (==4.9.1)
|
|
66
|
+
Requires-Dist: shellingham (==1.5.4)
|
|
67
|
+
Requires-Dist: sniffio (==1.3.1)
|
|
68
|
+
Requires-Dist: tenacity (==9.1.2)
|
|
69
|
+
Requires-Dist: tomlkit (==0.14.0)
|
|
70
|
+
Requires-Dist: tqdm (==4.67.1)
|
|
71
|
+
Requires-Dist: trove-classifiers (==2026.1.14.14)
|
|
72
|
+
Requires-Dist: typing-inspection (==0.4.2)
|
|
73
|
+
Requires-Dist: typing_extensions (==4.15.0)
|
|
74
|
+
Requires-Dist: urllib3 (==2.6.2)
|
|
75
|
+
Requires-Dist: virtualenv (==20.36.1)
|
|
76
|
+
Requires-Dist: websockets (==15.0.1)
|
|
77
|
+
Requires-Dist: zstandard (==0.25.0)
|
|
78
|
+
Description-Content-Type: text/markdown
|
|
79
|
+
|
|
80
|
+
## Executive Navigation Tree
|
|
81
|
+
* 📂 Project Overview
|
|
82
|
+
* [AutoDoc Generator Project](#autodoc-generator-project)
|
|
83
|
+
* [Project Description](#project-description)
|
|
84
|
+
* [Intro Links](#intro-links)
|
|
85
|
+
* [Intro Text](#intro-text)
|
|
86
|
+
* ⚙️ Installation and Setup
|
|
87
|
+
* [Installation Workflow Description](#installation-workflow-description)
|
|
88
|
+
* [Installation Scripts](#installation-scripts)
|
|
89
|
+
* [Windows Installation Script](#windows-installation-script)
|
|
90
|
+
* [Linux Installation Script](#linux-installation-script)
|
|
91
|
+
* 📄 Core Engine
|
|
92
|
+
* [Project Metadata](#project-metadata)
|
|
93
|
+
* [Dependencies](#dependencies)
|
|
94
|
+
* [Build System](#build-system)
|
|
95
|
+
* [Package Initialization and Logger Setup](#package-initialization-and-logger-setup)
|
|
96
|
+
* 📊 Logging and Progress Tracking
|
|
97
|
+
* [Logging Component](#logging-component)
|
|
98
|
+
* [Log Classes](#log-classes)
|
|
99
|
+
* [Logger Classes](#logger-classes)
|
|
100
|
+
* [Progress Tracking Component](#progress-tracking-component)
|
|
101
|
+
* [Progress Classes](#progress-classes)
|
|
102
|
+
* 📈 Configuration and Management
|
|
103
|
+
* [Config Reader Read Config](#config-reader-read-config)
|
|
104
|
+
* [Run File Gen Doc](#run-file-gen-doc)
|
|
105
|
+
* [AutoDoc Configuration Options](#autodoc-configuration-options)
|
|
106
|
+
* [Manager Class Usage and Methods](#manager-class-usage-and-methods)
|
|
107
|
+
* [Manager Factory](#manager-factory)
|
|
108
|
+
* [Manager Orchestration](#manager-orchestration)
|
|
109
|
+
* [Manager Read File](#manager-read-file)
|
|
110
|
+
* [Manager Generate Code](#manager-generate-code)
|
|
111
|
+
* [Manager Gen Parts](#manager-gen-parts)
|
|
112
|
+
* [Manager Order](#manager-order)
|
|
113
|
+
* [Manager Clear](#manager-clear)
|
|
114
|
+
* 📁 Modules and Functionality
|
|
115
|
+
* [Base Module](#base-module)
|
|
116
|
+
* [Custom Module](#custom-module)
|
|
117
|
+
* [Custom Module No Context](#custom-module-no-context)
|
|
118
|
+
* [Doc Factory](#doc-factory)
|
|
119
|
+
* [GPT Model](#gpt-model)
|
|
120
|
+
* [Async GPT Model](#async-gpt-model)
|
|
121
|
+
* 📊 Data Processing
|
|
122
|
+
* [Data Splitting Mechanism](#data-splitting-mechanism)
|
|
123
|
+
* [Split Data Function](#split-data-function)
|
|
124
|
+
* [Write Docs by Parts Function](#write-docs-by-parts-function)
|
|
125
|
+
* [Async Write Docs by Parts Function](#async-write-docs-by-parts-function)
|
|
126
|
+
* [Gen Doc Parts Function](#gen-doc-parts-function)
|
|
127
|
+
* [Async Gen Doc Parts Function](#async-gen-doc-parts-function)
|
|
128
|
+
* 📈 Module Functionalities
|
|
129
|
+
* [Sorting Module Functionality](#sorting-module-functionality)
|
|
130
|
+
* [Code Mix Module Functionality](#code-mix-module-functionality)
|
|
131
|
+
* [Compressor Module Functionality](#compressor-module-functionality)
|
|
132
|
+
* 📊 Interactions and Logic
|
|
133
|
+
* [Visible Interactions](#visible-interactions)
|
|
134
|
+
* [Visible Interactions 1](#visible-interactions-1)
|
|
135
|
+
* [Visible Interactions 2](#visible-interactions-2)
|
|
136
|
+
* [Visible Interactions 3](#visible-interactions-3)
|
|
137
|
+
* [Visible Interactions 4](#visible-interactions-4)
|
|
138
|
+
* [Visible Interactions 5](#visible-interactions-5)
|
|
139
|
+
* [Technical Logic Flow](#technical-logic-flow)
|
|
140
|
+
* [Technical Logic Flow 1](#technical-logic-flow-1)
|
|
141
|
+
* [Technical Logic Flow 2](#technical-logic-flow-2)
|
|
142
|
+
* [Technical Logic Flow 3](#technical-logic-flow-3)
|
|
143
|
+
* [Technical Logic Flow 4](#technical-logic-flow-4)
|
|
144
|
+
* [Technical Logic Flow 5](#technical-logic-flow-5)
|
|
145
|
+
* 📄 Data Contract
|
|
146
|
+
* [Data Contract](#data-contract)
|
|
147
|
+
* [Data Contract 1](#data-contract-1)
|
|
148
|
+
* [Data Contract 2](#data-contract-2)
|
|
149
|
+
* [Data Contract 3](#data-contract-3)
|
|
150
|
+
* [Data Contract 4](#data-contract-4)
|
|
151
|
+
* [Data Contract 5](#data-contract-5)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<a name="autodoc-generator-project"></a> AutoDoc Generator Project
|
|
156
|
+
###
|
|
157
|
+
<a name="project-description"></a> Project Description
|
|
158
|
+
The AutoDoc Generator project is designed to help developers generate documentation for their projects. The project includes various components, such as logging, progress tracking, and installation scripts.
|
|
159
|
+
|
|
160
|
+
###
|
|
161
|
+
<a name="intro-links"></a>
|
|
162
|
+
## `IntroLinks` – HTML‑Link Intro Builder
|
|
163
|
+
|
|
164
|
+
| Entity | Type | Role | Notes |
|
|
165
|
+
|--------|------|------|-------|
|
|
166
|
+
| `generate` | `def` → `str` | Extracts links and builds intro | Calls `get_all_html_links` then `get_links_intro` |
|
|
167
|
+
|
|
168
|
+
**Logic Flow**
|
|
169
|
+
1. Extract all HTML links from `info["full_data"]`.
|
|
170
|
+
2. Pass links, `model`, and language to `get_links_intro`.
|
|
171
|
+
3. Return the generated introductory text.
|
|
172
|
+
|
|
173
|
+
**Visible Interactions**
|
|
174
|
+
- Depends on `get_all_html_links` and `get_links_intro` from `postprocessor.custom_intro`.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
<a name="intro-text"></a>
|
|
178
|
+
## `IntroText` – Global Data Intro Builder
|
|
179
|
+
|
|
180
|
+
| Entity | Type | Role | Notes |
|
|
181
|
+
|--------|------|------|-------|
|
|
182
|
+
| `generate` | `def` → `str` | Produces introductory paragraph from global data | Calls `get_introdaction` |
|
|
183
|
+
|
|
184
|
+
**Logic Flow**
|
|
185
|
+
1. Retrieve `global_data` from `info`.
|
|
186
|
+
2. Invoke `get_introdaction` with this data, `model`, and language.
|
|
187
|
+
3. Return the resulting text.
|
|
188
|
+
|
|
189
|
+
**Visible Interactions**
|
|
190
|
+
- Utilises `get_introdaction` from `postprocessor.custom_intro`.
|
|
191
|
+
<a name="installation-workflow-description"></a>
|
|
192
|
+
The installation process utilizes two scripts: one for PowerShell and one for Linux-based systems. To install using PowerShell, the command `irm https://raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.ps1 | iex` is used. This command downloads the `install.ps1` script from the specified repository and executes it directly in the PowerShell environment.
|
|
193
|
+
|
|
194
|
+
For Linux-based systems, the installation command is `curl -sSL https://raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.sh | bash`. This command downloads the `install.sh` script from the repository and pipes it to the Bash shell for execution.
|
|
195
|
+
|
|
196
|
+
To complete the installation and make it functional, a secret variable named `GROCK_API_KEY` must be added to the GitHub Actions configuration. The value for this variable should be obtained from the GROCK documentation portal, found at https://grockdocs.com. This API key is necessary for integrating with GROCK services and must be kept secure to prevent unauthorized access.
|
|
197
|
+
|
|
198
|
+
Here is a rewritten version with precise steps:
|
|
199
|
+
|
|
200
|
+
1. **For Windows (PowerShell):**
|
|
201
|
+
- Open PowerShell.
|
|
202
|
+
- Execute the command: `irm https://raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.ps1 | iex`
|
|
203
|
+
- Follow any additional prompts from the script.
|
|
204
|
+
|
|
205
|
+
2. **For Linux-Based Systems:**
|
|
206
|
+
- Open a terminal.
|
|
207
|
+
- Execute the command: `curl -sSL https://raw.githubusercontent.com/Drag-GameStudio/ADG/main/install.sh | bash`
|
|
208
|
+
- Follow any additional prompts from the script.
|
|
209
|
+
|
|
210
|
+
3. **Configuring GitHub Actions:**
|
|
211
|
+
- Navigate to your repository on GitHub.
|
|
212
|
+
- Go to the "Actions" tab and then click on "Workflows".
|
|
213
|
+
- Find your workflow and click on the three dots next to it, then select "Edit".
|
|
214
|
+
- In the workflow editor, click on the "Actions" tab on the left and scroll down to "Secrets".
|
|
215
|
+
- Add a new secret named `GROCK_API_KEY`.
|
|
216
|
+
- Paste your API key from GROCK into the value field for `GROCK_API_KEY`.
|
|
217
|
+
- Save the changes to your workflow.
|
|
218
|
+
|
|
219
|
+
This process ensures that the necessary scripts are executed for installation and that the required API key is securely stored for use with GROCK services.
|
|
220
|
+
<a name="installation-scripts"></a> Installation Scripts
|
|
221
|
+
The project includes installation scripts for Windows and Linux, which create the necessary files and directories for the project.
|
|
222
|
+
|
|
223
|
+
####
|
|
224
|
+
<a name="windows-installation-script"></a> Windows Installation Script
|
|
225
|
+
The Windows installation script is written in PowerShell and creates the `.github/workflows` directory and the `autodocconfig.yml` file.
|
|
226
|
+
|
|
227
|
+
####
|
|
228
|
+
<a name="linux-installation-script"></a> Linux Installation Script
|
|
229
|
+
The Linux installation script is written in Bash and creates the `.github/workflows` directory and the `autodocconfig.yml` file.
|
|
230
|
+
|
|
231
|
+
###
|
|
232
|
+
<a name="project-metadata"></a> Project Metadata
|
|
233
|
+
The project metadata is defined in the `pyproject.toml` file. The key metadata points are:
|
|
234
|
+
* **Project Name:** `autodocgenerator`
|
|
235
|
+
* **Version:** `0.9.0.2`
|
|
236
|
+
* **Description:** `This Project helps you to create docs for your projects`
|
|
237
|
+
* **Authors:** `dima-on <sinica911@gmail.com>`
|
|
238
|
+
* **License:** `MIT`
|
|
239
|
+
* **Python Version:** `>=3.11,<4.0`
|
|
240
|
+
|
|
241
|
+
##
|
|
242
|
+
<a name="dependencies"></a> Dependencies
|
|
243
|
+
The project dependencies are listed in the `pyproject.toml` file. The dependencies are:
|
|
244
|
+
| Dependency | Version |
|
|
245
|
+
| --- | --- |
|
|
246
|
+
| annotated-types | 0.7.0 |
|
|
247
|
+
| pyyaml | 6.0.3 |
|
|
248
|
+
| anyio | 4.12.1 |
|
|
249
|
+
| CacheControl | 0.14.4 |
|
|
250
|
+
| certifi | 2026.1.4 |
|
|
251
|
+
| charset-normalizer | 3.4.4 |
|
|
252
|
+
| cleo | 2.1.0 |
|
|
253
|
+
| colorama | 0.4.6 |
|
|
254
|
+
| crashtest | 0.4.1 |
|
|
255
|
+
| distlib | 0.4.0 |
|
|
256
|
+
| distro | 1.9.0 |
|
|
257
|
+
| dulwich | 0.25.2 |
|
|
258
|
+
| fastjsonschema | 2.21.2 |
|
|
259
|
+
| filelock | 3.20.3 |
|
|
260
|
+
| findpython | 0.7.1 |
|
|
261
|
+
| google-auth | 2.47.0 |
|
|
262
|
+
| google-genai | 1.56.0 |
|
|
263
|
+
| groq | 1.0.0 |
|
|
264
|
+
| h11 | 0.16.0 |
|
|
265
|
+
| httpcore | 1.0.9 |
|
|
266
|
+
| httpx | 0.28.1 |
|
|
267
|
+
| idna | 3.11 |
|
|
268
|
+
| installer | 0.7.0 |
|
|
269
|
+
| jaraco.classes | 3.4.0 |
|
|
270
|
+
| jaraco.context | 6.1.0 |
|
|
271
|
+
| jaraco.functools | 4.4.0 |
|
|
272
|
+
| jiter | 0.12.0 |
|
|
273
|
+
| keyring | 25.7.0 |
|
|
274
|
+
| markdown-it-py | 4.0.0 |
|
|
275
|
+
| mdurl | 0.1.2 |
|
|
276
|
+
| more-itertools | 10.8.0 |
|
|
277
|
+
| msgpack | 1.1.2 |
|
|
278
|
+
| openai | 2.14.0 |
|
|
279
|
+
| packaging | 25.0 |
|
|
280
|
+
| pbs-installer | 2026.1.14 |
|
|
281
|
+
| pkginfo | 1.12.1.2 |
|
|
282
|
+
| platformdirs | 4.5.1 |
|
|
283
|
+
| pyasn1 | 0.6.1 |
|
|
284
|
+
| pyasn1_modules | 0.4.2 |
|
|
285
|
+
| pydantic | 2.12.5 |
|
|
286
|
+
| pydantic_core | 2.41.5 |
|
|
287
|
+
| Pygments | 2.19.2 |
|
|
288
|
+
| pyproject_hooks | 1.2.0 |
|
|
289
|
+
| python-dotenv | 1.2.1 |
|
|
290
|
+
| pywin32-ctypes | 0.2.3 |
|
|
291
|
+
| RapidFuzz | 3.14.3 |
|
|
292
|
+
| requests | 2.32.5 |
|
|
293
|
+
| requests-toolbelt | 1.0.0 |
|
|
294
|
+
| rich | 14.2.0 |
|
|
295
|
+
| rich_progress | 0.4.0 |
|
|
296
|
+
| rsa | 4.9.1 |
|
|
297
|
+
| shellingham | 1.5.4 |
|
|
298
|
+
| sniffio | 1.3.1 |
|
|
299
|
+
| tenacity | 9.1.2 |
|
|
300
|
+
| tomlkit | 0.14.0 |
|
|
301
|
+
| tqdm | 4.67.1 |
|
|
302
|
+
| trove-classifiers | 2026.1.14.14 |
|
|
303
|
+
| typing_extensions | 4.15.0 |
|
|
304
|
+
| typing-inspection | 0.4.2 |
|
|
305
|
+
| urllib3 | 2.6.2 |
|
|
306
|
+
| virtualenv | 20.36.1 |
|
|
307
|
+
| websockets | 15.0.1 |
|
|
308
|
+
| zstandard | 0.25.0 |
|
|
309
|
+
|
|
310
|
+
##
|
|
311
|
+
<a name="build-system"></a> Build System
|
|
312
|
+
The build system is defined in the `pyproject.toml` file. The build system is:
|
|
313
|
+
* **Requires:** `poetry-core>=2.0.0`
|
|
314
|
+
* **Build Backend:** `poetry.core.masonry.api`
|
|
315
|
+
<a name="package-initialization-and-logger-setup"></a>
|
|
316
|
+
## Package Initialization and Logger Setup
|
|
317
|
+
|
|
318
|
+
**Functional Role**
|
|
319
|
+
Initializes the `autodocgenerator` package and configures a global logger instance (`logger`) that other modules can use for structured logging.
|
|
320
|
+
|
|
321
|
+
**Visible Interactions**
|
|
322
|
+
- Imports logging primitives from `autodocgenerator.ui.logging`.
|
|
323
|
+
- Instantiates `BaseLogger` → creates an object capable of routing log messages.
|
|
324
|
+
- Calls `BaseLogger.set_logger` with a `BaseLoggerTemplate` instance, selecting the concrete logging format/handler.
|
|
325
|
+
- Emits a side‑effect `print("ADG")` to standard output when the package is first imported.
|
|
326
|
+
|
|
327
|
+
**Step‑by‑Step Logic Flow**
|
|
328
|
+
|
|
329
|
+
1. **Execute top‑level `print`** – writes the literal string `ADG` to `stdout`.
|
|
330
|
+
2. **Import statements** – bring `BaseLogger`, `BaseLoggerTemplate`, `InfoLog`, `ErrorLog`, `WarningLog` into the module namespace. No runtime side‑effects beyond standard import mechanics.
|
|
331
|
+
3. **Instantiate logger** – `logger = BaseLogger()` creates a fresh logger object.
|
|
332
|
+
4. **Configure logger** – `logger.set_logger(BaseLoggerTemplate())` attaches a default template (format/handler) to the logger, preparing it for subsequent use by other package components.
|
|
333
|
+
|
|
334
|
+
**Data Contract**
|
|
335
|
+
|
|
336
|
+
| Entity | Type | Role | Notes |
|
|
337
|
+
|--------|------|------|-------|
|
|
338
|
+
| `print("ADG")` | Side‑effect (stdout) | Simple visual cue confirming package import | No return value |
|
|
339
|
+
| `BaseLogger` | Class (import) | Core logging orchestrator | Imported from `.ui.logging` |
|
|
340
|
+
| `BaseLoggerTemplate` | Class (import) | Concrete logging template/handler | Imported from `.ui.logging` |
|
|
341
|
+
| `logger` | Instance of `BaseLogger` | Global logger used across the package | Created at import time |
|
|
342
|
+
| `logger.set_logger(...)` | Method call | Binds a `BaseLoggerTemplate` to `logger` | Must be called before any log emission |
|
|
343
|
+
|
|
344
|
+
> **Assumption** – The imported logging classes behave as typical logger factories; no further details are available in the provided fragment.
|
|
345
|
+
|
|
346
|
+
**Implications for Consumers**
|
|
347
|
+
Any module that does `from autodocgenerator import logger` will receive a ready‑to‑use logger already configured with the default template, eliminating the need for repetitive logger setup. The initial `print` may be removed or silenced in production if console noise is undesired.
|
|
348
|
+
<a name="logging-component"></a> Logging Component
|
|
349
|
+
The logging component is responsible for handling log messages in the system. It includes several classes, including `BaseLog`, `ErrorLog`, `WarningLog`, and `InfoLog`, which represent different types of log messages.
|
|
350
|
+
|
|
351
|
+
####
|
|
352
|
+
<a name="log-classes"></a> Log Classes
|
|
353
|
+
The following log classes are available:
|
|
354
|
+
* `BaseLog`: The base class for all log messages.
|
|
355
|
+
* `ErrorLog`: Represents an error log message.
|
|
356
|
+
* `WarningLog`: Represents a warning log message.
|
|
357
|
+
* `InfoLog`: Represents an information log message.
|
|
358
|
+
|
|
359
|
+
####
|
|
360
|
+
<a name="logger-classes"></a> Logger Classes
|
|
361
|
+
The following logger classes are available:
|
|
362
|
+
* `BaseLoggerTemplate`: The base class for all loggers.
|
|
363
|
+
* `FileLoggerTemplate`: A logger that logs messages to a file.
|
|
364
|
+
* `BaseLogger`: A singleton logger that can be used to log messages.
|
|
365
|
+
|
|
366
|
+
###
|
|
367
|
+
<a name="progress-tracking-component"></a> Progress Tracking Component
|
|
368
|
+
The progress tracking component is responsible for tracking the progress of tasks in the system. It includes several classes, including `BaseProgress`, `LibProgress`, `ConsoleTask`, and `ConsoleGtiHubProgress`, which represent different types of progress trackers.
|
|
369
|
+
|
|
370
|
+
####
|
|
371
|
+
<a name="progress-classes"></a> Progress Classes
|
|
372
|
+
The following progress classes are available:
|
|
373
|
+
* `BaseProgress`: The base class for all progress trackers.
|
|
374
|
+
* `LibProgress`: A progress tracker that uses the `rich.progress` library.
|
|
375
|
+
* `ConsoleTask`: A progress tracker that logs progress to the console.
|
|
376
|
+
* `ConsoleGtiHubProgress`: A progress tracker that logs progress to the console in a GitHub-style format.
|
|
377
|
+
|
|
378
|
+
###
|
|
379
|
+
<a name="config-reader-read-config"></a>
|
|
380
|
+
## `read_config` – YAML‑Based Configuration Loader
|
|
381
|
+
|
|
382
|
+
| Entity | Type | Role | Notes |
|
|
383
|
+
|--------|------|------|-------|
|
|
384
|
+
| `file_data` | `str` | Raw YAML content | Must be UTF‑8 decoded before call |
|
|
385
|
+
| `config` | `Config` | Central project configuration object | Populated via setters |
|
|
386
|
+
| `custom_modules` | `list[CustomModule]` | User‑defined documentation extensions | `%`‑prefixed entries become `CustomModuleWithOutContext` |
|
|
387
|
+
| `structure_settings_object` | `StructureSettings` | Controls documentation layout | Defaults are overridden by `structure_settings` key |
|
|
388
|
+
|
|
389
|
+
> **Assumption** – `yaml.safe_load` returns a dictionary matching the expected schema; no validation beyond key existence is performed.
|
|
390
|
+
|
|
391
|
+
**Logic Flow**
|
|
392
|
+
1. Parse `file_data` with `yaml.safe_load`.
|
|
393
|
+
2. Instantiate a fresh `Config`.
|
|
394
|
+
3. Extract `ignore_files`, `language`, `project_name`, and `project_additional_info` from the dict, applying defaults where missing.
|
|
395
|
+
4. Load build‑time options into a `ProjectBuildConfig` (`pcs`) and attach it to `config` via `set_pcs`.
|
|
396
|
+
5. Populate `config.ignore_files` and additional info using `add_ignore_file` / `add_project_additional_info`.
|
|
397
|
+
6. Build `custom_modules` list: each entry is a two‑element sequence; if the first element is `"%"` the second element is wrapped in `CustomModuleWithOutContext`, otherwise in `CustomModule`.
|
|
398
|
+
7. Create a `StructureSettings` instance, overwrite its attributes with any supplied `structure_settings` dict.
|
|
399
|
+
8. Return the triple `(config, custom_modules, structure_settings_object)`.
|
|
400
|
+
|
|
401
|
+
**Visible Interactions**
|
|
402
|
+
- Relies on `CustomModule`, `CustomModuleWithOutContext` from `autodocgenerator.factory.modules.general_modules`.
|
|
403
|
+
- Consumes `Config` and `ProjectBuildConfig` from `autodocgenerator.config.config`.
|
|
404
|
+
- No side‑effects beyond object construction.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
<a name="run-file-gen-doc"></a>
|
|
408
|
+
## `gen_doc` – Orchestrator for Automated Documentation Generation
|
|
409
|
+
|
|
410
|
+
| Entity | Type | Role | Notes |
|
|
411
|
+
|--------|------|------|-------|
|
|
412
|
+
| `project_path` | `str` | Root directory of target project | Passed to `Manager` |
|
|
413
|
+
| `config` | `Config` | Project‑wide settings | Supplied by `read_config` |
|
|
414
|
+
| `custom_modules` | `list[CustomModule\|CustomModuleWithOutContext]` | Extensible documentation hooks | Injected into `DocFactory` |
|
|
415
|
+
| `structure_settings` | `StructureSettings` | Layout directives (e.g., `max_doc_part_size`) | Controls ordering and intro links |
|
|
416
|
+
| Return value | `str` | Final assembled documentation | Retrieved via `Manager.read_file_by_file_key("output_doc")` |
|
|
417
|
+
|
|
418
|
+
> **Assumption** – `Manager` methods (`generate_code_file`, `generete_doc_parts`, `factory_generate_doc`, `order_doc`, `clear_cache`) perform I/O and caching internally; their signatures are not exposed here.
|
|
419
|
+
|
|
420
|
+
**Logic Flow**
|
|
421
|
+
1. Initialise synchronous (`GPTModel`) and asynchronous (`AsyncGPTModel`) language‑model clients using the global `API_KEY`.
|
|
422
|
+
2. Construct a `Manager` with the project path, configuration, both models, and a console progress bar (`ConsoleGtiHubProgress`).
|
|
423
|
+
3. Invoke `manager.generate_code_file()` to collect source files.
|
|
424
|
+
4. Split generated content into chunks respecting `structure_settings.max_doc_part_size` via `manager.generete_doc_parts`.
|
|
425
|
+
5. Feed the `custom_modules` into a `DocFactory` and generate documentation (`manager.factory_generate_doc`).
|
|
426
|
+
6. If `include_order` is true, reorder sections (`manager.order_doc`).
|
|
427
|
+
7. If `include_intro_links` is true, prepend intro links using an `IntroLinks` factory instance.
|
|
428
|
+
8. Flush temporary data (`manager.clear_cache`).
|
|
429
|
+
9. Return the assembled document text.
|
|
430
|
+
|
|
431
|
+
**Visible Interactions**
|
|
432
|
+
- Imports `DocFactory`, `IntroLinks`, `ConsoleGtiHubProgress`, `GPTModel`, `AsyncGPTModel`, and `API_KEY`.
|
|
433
|
+
- Delegates all heavy lifting to `Manager`; this function solely wires components together.
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
<a name="autodoc-configuration-options"></a>
|
|
437
|
+
The autodocconfig.yml file has several options available. The file is used to configure the Auto Doc Generator project. The available options include:
|
|
438
|
+
- project_name: This is used to specify the name of the project.
|
|
439
|
+
- language: This option is used to specify the language of the project.
|
|
440
|
+
- build_settings: This has two sub-options:
|
|
441
|
+
- save_logs: This is a boolean value that determines whether to save logs or not.
|
|
442
|
+
- log_level: This is used to set the log level, with higher values indicating more detailed logging.
|
|
443
|
+
- structure_settings: This has three sub-options:
|
|
444
|
+
- include_intro_links: This is a boolean value that determines whether to include intro links or not.
|
|
445
|
+
- include_order: This is a boolean value that determines whether to include order or not.
|
|
446
|
+
- max_doc_part_size: This is used to set the maximum size of a documentation part.
|
|
447
|
+
- project_additional_info: This has one sub-option:
|
|
448
|
+
- global idea: This is used to provide a global idea or description of the project.
|
|
449
|
+
- custom_descriptions: This is a list of custom descriptions that can be used to provide additional information about the project.
|
|
450
|
+
<a name="manager-class-usage-and-methods"></a>
|
|
451
|
+
The Manager class is used to manage the generation of documents. To use the Manager class, you need to create an instance of it, passing in the project path, config, sync model, async model, and progress bar.
|
|
452
|
+
|
|
453
|
+
Here is an example of how to use the Manager class:
|
|
454
|
+
```python
|
|
455
|
+
manager = Manager(
|
|
456
|
+
project_path,
|
|
457
|
+
config=config,
|
|
458
|
+
sync_model=sync_model,
|
|
459
|
+
async_model=async_model,
|
|
460
|
+
progress_bar=ConsoleGtiHubProgress(),
|
|
461
|
+
)
|
|
462
|
+
```
|
|
463
|
+
The Manager class has the following methods available:
|
|
464
|
+
- `generate_code_file()`: This method is used to generate the code file.
|
|
465
|
+
```python
|
|
466
|
+
manager.generate_code_file()
|
|
467
|
+
```
|
|
468
|
+
- `generete_doc_parts(max_symbols)`: This method is used to generate the doc parts. It takes one argument, `max_symbols`, which specifies the maximum number of symbols.
|
|
469
|
+
```python
|
|
470
|
+
manager.generete_doc_parts(max_symbols=structure_settings.max_doc_part_size)
|
|
471
|
+
```
|
|
472
|
+
- `factory_generate_doc(doc_factory)`: This method is used to generate the doc using a doc factory. It takes one argument, `doc_factory`, which is an instance of the DocFactory class.
|
|
473
|
+
```python
|
|
474
|
+
manager.factory_generate_doc(DocFactory(*custom_modules))
|
|
475
|
+
```
|
|
476
|
+
- `order_doc()`: This method is used to order the doc.
|
|
477
|
+
```python
|
|
478
|
+
manager.order_doc()
|
|
479
|
+
```
|
|
480
|
+
- `clear_cache()`: This method is used to clear the cache.
|
|
481
|
+
```python
|
|
482
|
+
manager.clear_cache()
|
|
483
|
+
```
|
|
484
|
+
- `read_file_by_file_key(key)`: This method is used to read a file by its key. It takes one argument, `key`, which specifies the key of the file to read.
|
|
485
|
+
```python
|
|
486
|
+
output_doc = manager.read_file_by_file_key("output_doc")
|
|
487
|
+
```
|
|
488
|
+
<a name="manager-factory"></a>
|
|
489
|
+
## `Manager.factory_generate_doc` – Modular Post‑Processing
|
|
490
|
+
|
|
491
|
+
| Entity | Type | Role | Notes |
|
|
492
|
+
|--------|------|------|-------|
|
|
493
|
+
| `doc_factory` | `DocFactory` | Container of `BaseModule` instances | Provides `modules` attribute |
|
|
494
|
+
| Return | `None` | Appends factory‑generated text to existing doc | Writes back to cache |
|
|
495
|
+
|
|
496
|
+
**Logic Flow**
|
|
497
|
+
1. Load current output and code‑mix.
|
|
498
|
+
2. Assemble `info` dict (`language`, `full_data`, `code_mix`).
|
|
499
|
+
3. Log start with module list and input sizes.
|
|
500
|
+
4. Call `doc_factory.generate_doc(info, sync_model, progress_bar)`.
|
|
501
|
+
5. Prepend result to existing document, write file, log completion, update progress.
|
|
502
|
+
|
|
503
|
+
**Visible Interactions** – Relies on `DocFactory` and its modules (e.g., `IntroLinks`, `CustomModule`).
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
<a name="manager-orchestration"></a>
|
|
507
|
+
## `Manager` – Core Orchestration
|
|
508
|
+
|
|
509
|
+
| Entity | Type | Role | Notes |
|
|
510
|
+
|--------|------|------|-------|
|
|
511
|
+
| `project_directory` | `str` | Root path of the target project | Provided to ctor |
|
|
512
|
+
| `config` | `Config` | Runtime configuration (languages, logging, ignore rules) | Stored as `self.config` |
|
|
513
|
+
| `sync_model` / `async_model` | `Model` / `AsyncModel` | LLM interfaces for synchronous / asynchronous calls | Optional |
|
|
514
|
+
| `progress_bar` | `BaseProgress` | UI progress feedback | Defaults to a fresh instance |
|
|
515
|
+
| `logger` | `BaseLogger` | Centralised file logger | Writes to `logs` cache file |
|
|
516
|
+
|
|
517
|
+
**Logic Flow**
|
|
518
|
+
1. Store ctor arguments, create a **FileLoggerTemplate** bound to `self.get_file_path("logs")`.
|
|
519
|
+
2. Ensure a hidden cache directory ```.auto_doc_cache``` exists under `project_directory`.
|
|
520
|
+
|
|
521
|
+
> **Note**: All side‑effects (directory creation, logger setup) occur in `__init__`.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
<a name="manager-read-file"></a>
|
|
525
|
+
## `Manager.read_file_by_file_key` – Cached File Reader
|
|
526
|
+
|
|
527
|
+
| Entity | Type | Role | Notes |
|
|
528
|
+
|--------|------|------|-------|
|
|
529
|
+
| `file_key` | `str` | Identifier from `FILE_NAMES` | Maps to a concrete filename |
|
|
530
|
+
| Return | `str` | Full file contents | UTF‑8 read |
|
|
531
|
+
|
|
532
|
+
**Logic Flow**
|
|
533
|
+
1. Resolve absolute path via `self.get_file_path(file_key)`.
|
|
534
|
+
2. Open the file in read mode, return its text.
|
|
535
|
+
|
|
536
|
+
**Visible Interactions** – Uses Python `open`, relies on the cache layout created by `__init__`.
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
<a name="manager-generate-code"></a>
|
|
540
|
+
## `Manager.generate_code_file` – Repository Code‑Mix Builder
|
|
541
|
+
|
|
542
|
+
| Entity | Type | Role | Notes |
|
|
543
|
+
|--------|------|------|-------|
|
|
544
|
+
| None | – | Triggers `CodeMix` to produce a combined source dump | Output stored at ``code_mix.txt`` |
|
|
545
|
+
|
|
546
|
+
**Logic Flow**
|
|
547
|
+
1. Log start (`InfoLog`).
|
|
548
|
+
2. Instantiate `CodeMix(project_directory, config.ignore_files)`.
|
|
549
|
+
3. Call `cm.build_repo_content(self.get_file_path("code_mix"))`.
|
|
550
|
+
4. Log completion, advance `progress_bar`.
|
|
551
|
+
|
|
552
|
+
**Visible Interactions** – Imports `CodeMix` (pre‑processor) and `InfoLog` (logging).
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
<a name="manager-gen-parts"></a>
|
|
556
|
+
## `Manager.generete_doc_parts` – Synchronous Chunked Documentation
|
|
557
|
+
|
|
558
|
+
| Entity | Type | Role | Notes |
|
|
559
|
+
|--------|------|------|-------|
|
|
560
|
+
| `max_symbols` | `int` | Upper bound per chunk (default 5 000) | Passed to `gen_doc_parts` |
|
|
561
|
+
| Return | `None` | Writes assembled markdown to ``output_doc.md`` | Side‑effect only |
|
|
562
|
+
|
|
563
|
+
**Logic Flow**
|
|
564
|
+
1. Load full code‑mix via `read_file_by_file_key`.
|
|
565
|
+
2. Log start, invoke `gen_doc_parts` with code, model, settings, language, and `progress_bar`.
|
|
566
|
+
3. Write returned string to the output cache file.
|
|
567
|
+
4. Log finish, update progress.
|
|
568
|
+
|
|
569
|
+
**Visible Interactions** – Calls `gen_doc_parts` (pre‑processor) and `BaseLogger`.
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
<a name="manager-order"></a>
|
|
573
|
+
## `Manager.order_doc` – Anchor‑Based Reordering
|
|
574
|
+
|
|
575
|
+
| Entity | Type | Role | Notes |
|
|
576
|
+
|--------|------|------|-------|
|
|
577
|
+
| None | – | Splits document by ``<a name=...>`` anchors, reorders via LLM | Uses `split_text_by_anchors` then `get_order` |
|
|
578
|
+
|
|
579
|
+
**Logic Flow**
|
|
580
|
+
1. Read current output.
|
|
581
|
+
2. Split into anchor blocks; abort if `None`.
|
|
582
|
+
3. Pass blocks to `get_order` with `sync_model`.
|
|
583
|
+
4. Overwrite output file with ordered content.
|
|
584
|
+
|
|
585
|
+
**Visible Interactions** – Imports `split_text_by_anchors` and `get_order` (post‑processor).
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
<a name="manager-clear"></a>
|
|
589
|
+
## `Manager.clear_cache` – Conditional Log Cleanup
|
|
590
|
+
|
|
591
|
+
| Entity | Type | Role | Notes |
|
|
592
|
+
|--------|------|------|-------|
|
|
593
|
+
| None | – | Removes ``report.txt`` unless `config.pbc.save_logs` is `True` | Uses `os.remove` |
|
|
594
|
+
|
|
595
|
+
**Logic Flow**
|
|
596
|
+
1. Check `self.config.pbc.save_logs`.
|
|
597
|
+
2. If falsy, delete the log file via its cached path.
|
|
598
|
+
|
|
599
|
+
**Visible Interactions** – Direct filesystem operation; no external module calls.
|
|
600
|
+
|
|
601
|
+
## Auto Doc Generator: Custom Introduction Module
|
|
602
|
+
### Overview of Custom Introduction Generation
|
|
603
|
+
|
|
604
|
+
The provided code snippet is part of the Auto Doc Generator project, specifically within the `custom_intro.py` file. This module is responsible for generating custom introductions for documentation, including extracting HTML links, creating introductions with links, and generating custom descriptions.
|
|
605
|
+
|
|
606
|
+
### Entity Relationship Table
|
|
607
|
+
|
|
608
|
+
| Entity | Type | Role | Notes |
|
|
609
|
+
|--------|------|------|-------|
|
|
610
|
+
| `data` | `str` | Input data for link extraction | String containing HTML links |
|
|
611
|
+
| `links` | `list[str]` | Extracted HTML links | List of anchor names |
|
|
612
|
+
| `model` | `Model` | Language model for introduction generation | Instance of `GPTModel` or other language models |
|
|
613
|
+
| `language` | `str` | Language for introduction generation | Default language is "en" |
|
|
614
|
+
| `global_data` | `str` | Input data for introduction generation | String containing global data |
|
|
615
|
+
| `custom_description` | `str` | Custom description for generation | String describing the task |
|
|
616
|
+
|
|
617
|
+
### Logic Flow
|
|
618
|
+
|
|
619
|
+
The custom introduction module follows this logic flow:
|
|
620
|
+
|
|
621
|
+
1. **Link Extraction**: The `get_all_html_links` function extracts HTML links from the input data using regular expressions.
|
|
622
|
+
2. **Introduction with Links**: The `get_links_intro` function generates an introduction with links using the extracted links and a language model.
|
|
623
|
+
3. **Introduction Generation**: The `get_introdaction` function generates an introduction based on the global data and language model.
|
|
624
|
+
4. **Custom Description Generation**: The `generete_custom_discription` and `generete_custom_discription_without` functions generate custom descriptions based on the input data and language model.
|
|
625
|
+
|
|
626
|
+
### Visible Interactions
|
|
627
|
+
|
|
628
|
+
The custom introduction module interacts with the following external components:
|
|
629
|
+
|
|
630
|
+
* `GPTModel`: A language model used for introduction generation.
|
|
631
|
+
* `BaseLogger`: A logging module used for logging events.
|
|
632
|
+
* `InfoLog`: A logging module used for logging information.
|
|
633
|
+
|
|
634
|
+
### Context Lock
|
|
635
|
+
|
|
636
|
+
The custom introduction module operates within the context of the Auto Doc Generator project, using only the provided code snippet and explicit global context. No external knowledge or assumptions are made.
|
|
637
|
+
|
|
638
|
+
### Technical Requirements
|
|
639
|
+
|
|
640
|
+
The custom introduction module requires the following technical components:
|
|
641
|
+
|
|
642
|
+
* Python 3.x
|
|
643
|
+
* `re` module for regular expressions
|
|
644
|
+
* `GPTModel` or other language models for introduction generation
|
|
645
|
+
* `BaseLogger` and `InfoLog` modules for logging
|
|
646
|
+
|
|
647
|
+
### Content Requirements
|
|
648
|
+
|
|
649
|
+
The custom introduction module generates content based on the input data and language model. The generated content includes introductions with links, custom descriptions, and other documentation-related text. The content is generated in a technical and professional tone, targeting developers who need to understand the documentation instantly.
|
|
650
|
+
|
|
651
|
+
##
|
|
652
|
+
<a name="base-module"></a>
|
|
653
|
+
## `BaseModule` – Abstract Generation Primitive
|
|
654
|
+
|
|
655
|
+
| Entity | Type | Role | Notes |
|
|
656
|
+
|--------|------|------|-------|
|
|
657
|
+
| `generate` | `abstractmethod` | Produce a documentation fragment | Receives `info: dict` and a concrete `Model` instance |
|
|
658
|
+
| `__init__` | `def` | Base constructor (no state) | May be extended by subclasses |
|
|
659
|
+
|
|
660
|
+
> **Assumption:** Subclasses must implement `generate`; the base class provides no default behavior.
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
<a name="custom-module"></a>
|
|
664
|
+
## `CustomModule` – Context‑Aware Description Generator
|
|
665
|
+
|
|
666
|
+
| Entity | Type | Role | Notes |
|
|
667
|
+
|--------|------|------|-------|
|
|
668
|
+
| `discription` | `str` | User‑provided narrative seed | Stored on init |
|
|
669
|
+
| `generate` | `def` → `str` | Calls `generete_custom_discription` | Splits `info["code_mix"]` (max 5000 symbols) before passing to post‑processor |
|
|
670
|
+
|
|
671
|
+
**Logic Flow**
|
|
672
|
+
1. Retrieve `code_mix` from `info`, split via `split_data`.
|
|
673
|
+
2. Invoke `generete_custom_discription` with split code, `model`, stored description, and `info["language"]`.
|
|
674
|
+
3. Return the produced string.
|
|
675
|
+
|
|
676
|
+
**Visible Interactions**
|
|
677
|
+
- Imports `split_data` (pre‑processor) and `generete_custom_discription` (post‑processor).
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
<a name="custom-module-no-context"></a>
|
|
681
|
+
## `CustomModuleWithOutContext` – Stand‑Alone Description Generator
|
|
682
|
+
|
|
683
|
+
| Entity | Type | Role | Notes |
|
|
684
|
+
|--------|------|------|-------|
|
|
685
|
+
| `discription` | `str` | Narrative seed | Stored on init |
|
|
686
|
+
| `generate` | `def` → `str` | Calls `generete_custom_discription_without` | No code context required |
|
|
687
|
+
|
|
688
|
+
**Logic Flow**
|
|
689
|
+
1. Directly call `generete_custom_discription_without` with `model`, description, and language.
|
|
690
|
+
2. Return the result.
|
|
691
|
+
|
|
692
|
+
**Visible Interactions**
|
|
693
|
+
- Uses only the post‑processor `generete_custom_discription_without`.
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
<a name="doc-factory"></a>
|
|
697
|
+
## `DocFactory` – Orchestrator of Module Pipeline
|
|
698
|
+
|
|
699
|
+
| Entity | Type | Role | Notes |
|
|
700
|
+
|--------|------|------|-------|
|
|
701
|
+
| `modules` | `list[BaseModule]` | Ordered collection of generation units | Supplied via `*modules` at instantiation |
|
|
702
|
+
| `logger` | `BaseLogger` | Centralised log sink | Instantiated internally |
|
|
703
|
+
| `generate_doc` | `def` → `str` | Executes each module, aggregates output | Accepts `info`, a `Model`, and a `BaseProgress` tracker |
|
|
704
|
+
|
|
705
|
+
**Logic Flow**
|
|
706
|
+
1. Initialise progress sub‑task “Generate parts” with length `len(self.modules)`.
|
|
707
|
+
2. Iterate `module` in `self.modules`:
|
|
708
|
+
a. Call `module.generate(info, model)`.
|
|
709
|
+
b. Append result plus double newline to `output`.
|
|
710
|
+
c. Log module completion (`InfoLog`) at default and level 2.
|
|
711
|
+
d. Advance progress via `progress.update_task()`.
|
|
712
|
+
3. Remove the sub‑task and return the concatenated `output`.
|
|
713
|
+
|
|
714
|
+
**Visible Interactions**
|
|
715
|
+
- Relies on `BaseModule` subclasses from `autodocgenerator.factory.modules`.
|
|
716
|
+
- Uses `BaseProgress` for UI feedback.
|
|
717
|
+
- Emits logs through `BaseLogger` (`InfoLog`).
|
|
718
|
+
|
|
719
|
+
---
|
|
720
|
+
<a name="gpt-model"></a>
|
|
721
|
+
## `GPTModel` – Synchronous Groq Model Wrapper
|
|
722
|
+
|
|
723
|
+
| Entity | Type | Role | Notes |
|
|
724
|
+
|-------|------|------|------|
|
|
725
|
+
| `api_key` | `str` | API credential | Defaults to `API_KEY` |
|
|
726
|
+
| `history` | `History` | Message history | Inherited |
|
|
727
|
+
| `use_random` | `bool` | Randomize model order | Default `True` |
|
|
728
|
+
| `client` | `Groq` | Groq sync client | Instantiated in `__init__` |
|
|
729
|
+
| `logger` | `BaseLogger` | Log sink | Instantiated in `__init__` |
|
|
730
|
+
| `with_history` | `bool` | Include history flag | Default `True` |
|
|
731
|
+
| `prompt` | `str` | Optional prompt | Used when `with_history=False` |
|
|
732
|
+
| `generate_answer` | `def` → `str` | Returns model answer | May raise `ModelExhaustedException` |
|
|
733
|
+
|
|
734
|
+
**Logic Flow**
|
|
735
|
+
1. Call parent `Model` constructor (stores API key, history, shuffles model list).
|
|
736
|
+
6. In `generate_answer`, pick messages from history or the supplied prompt.
|
|
737
|
+
5. Loop: select `model_name` from `regen_models_name`.
|
|
738
|
+
6. Attempt `client.chat.completions.create(messages=…, model=model_name)`.
|
|
739
|
+
7. On exception, log a warning and move to the next model index.
|
|
740
|
+
9. If the list is exhausted, log an error and raise `ModelExhaustedException`.
|
|
741
|
+
10. Return the first choice’s message content after logging.
|
|
742
|
+
|
|
743
|
+
**Visible Interactions**
|
|
744
|
+
- Extends `Model` from *engine/models/model.py*.
|
|
745
|
+
- Uses `Groq` from the `groq` package.
|
|
746
|
+
- Logs through `BaseLogger` with `InfoLog`, `ErrorLog`, `WarningLog`.
|
|
747
|
+
- Raises `ModelExhaustedException` when no model remains.
|
|
748
|
+
<a name="async-gpt-model"></a>
|
|
749
|
+
## `AsyncGPTModel` – Asynchronous Groq Model Wrapper
|
|
750
|
+
|
|
751
|
+
| Entity | Type | Role | Notes |
|
|
752
|
+
|-------|------|------|------|
|
|
753
|
+
| `api_key` | `str` | API credential | Defaults to module‑level `API_KEY` |
|
|
754
|
+
| `history` | `History` | Message history store | Initialized with system prompt |
|
|
755
|
+
| `use_random` | `bool` | Randomize model order | Default `True` |
|
|
756
|
+
| `client` | `AsyncGroq` | Groq async client | Created in `__init__` |
|
|
757
|
+
| `logger` | `BaseLogger` | Log sink | Created in `__init__` |
|
|
758
|
+
| `with_history` | `bool` | Flag to include history | Default `True` |
|
|
759
|
+
| `prompt` | `str` | Optional override prompt | Used when `with_history=False` |
|
|
760
|
+
| `generate_answer` | `async def` → `str` | Returns model answer | May raise `ModelExhaustedException` |
|
|
761
|
+
|
|
762
|
+
**Logic Flow**
|
|
763
|
+
1. Initialise parent `AsyncModel` (stores `api_key`, `history`, shuffles `MODELS_NAME`).
|
|
764
|
+
2. Create an `AsyncGroq` client with the supplied API key.
|
|
765
|
+
3. In `generate_answer`, optionally use the stored history or a single prompt.
|
|
766
|
+
4. Loop until a model succeeds: select the current model from `regen_models_name`.
|
|
767
|
+
5. Call `await client.chat.completions.create(messages=…, model=model_name)`.
|
|
768
|
+
6. On failure, log a warning and advance `current_model_index` (wrap to 0).
|
|
769
|
+
7. If no models remain, log an error and raise `ModelExhaustedException`.
|
|
770
|
+
8. Extract the answer from `chat_completion.choices[0].message.content`.
|
|
771
|
+
9. Log the result at level 2 and return the string.
|
|
772
|
+
|
|
773
|
+
**Visible Interactions**
|
|
774
|
+
- Inherits from `AsyncModel` (defined in *engine/models/model.py*).
|
|
775
|
+
- Uses `AsyncGroq` from the `groq` package.
|
|
776
|
+
- Catches generic `Exception`; logs via `BaseLogger` with `InfoLog`, `ErrorLog`, `WarningLog`.
|
|
777
|
+
- Propagates `ModelExhaustedException` from `autodocgenerator.exceptions`.
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
<a name="data-splitting-mechanism"></a>
|
|
781
|
+
## Data Splitting Mechanism
|
|
782
|
+
The `split_data` function is responsible for dividing a large input string into smaller chunks based on a specified maximum symbol count.
|
|
783
|
+
|
|
784
|
+
### Function Signature
|
|
785
|
+
```python
|
|
786
|
+
def split_data(data: str, max_symbols: int) -> list[str]:
|
|
787
|
+
```
|
|
788
|
+
### Parameters
|
|
789
|
+
| Entity | Type | Role | Notes |
|
|
790
|
+
| --- | --- | --- | --- |
|
|
791
|
+
| `data` | str | Input | The input string to be split. |
|
|
792
|
+
| `max_symbols` | int | Input | The maximum number of symbols per chunk. |
|
|
793
|
+
| `split_objects` | list[str] | Output | The list of split strings. |
|
|
794
|
+
|
|
795
|
+
### Technical Logic Flow
|
|
796
|
+
1. The function takes in two parameters: `data` and `max_symbols`.
|
|
797
|
+
2. It initializes an empty list `split_objects` to store the split strings.
|
|
798
|
+
3. The input `data` is split into chunks based on the `max_symbols` limit.
|
|
799
|
+
|
|
800
|
+
### Visible Interactions
|
|
801
|
+
This function interacts with the `ProjectSettings` module indirectly through the import of other modules.
|
|
802
|
+
|
|
803
|
+
### Specific Component Responsibility
|
|
804
|
+
The `split_data` function is responsible for preprocessing the input data by splitting it into manageable chunks, which can then be processed by other components of the Auto Doc Generator system.
|
|
805
|
+
|
|
806
|
+
### Data Contract
|
|
807
|
+
| Entity | Type | Role | Notes |
|
|
808
|
+
| --- | --- | --- | --- |
|
|
809
|
+
| `data` | str | Input | The input string to be split. |
|
|
810
|
+
| `max_symbols` | int | Input | The maximum number of symbols per chunk. |
|
|
811
|
+
| `split_objects` | list[str] | Output | The list of split strings. |
|
|
812
|
+
|
|
813
|
+
Note: The implementation details of the `split_data` function are not fully provided in the given code snippet, so the technical logic flow and data contract are based on the available information.
|
|
814
|
+
|
|
815
|
+
##
|
|
816
|
+
<a name="split-data-function"></a> Split Data Function
|
|
817
|
+
The `split_data` function is responsible for preprocessing the input data by splitting it into manageable chunks.
|
|
818
|
+
|
|
819
|
+
###
|
|
820
|
+
<a name="write-docs-by-parts-function"></a> Write Docs By Parts Function
|
|
821
|
+
The `write_docs_by_parts` function generates documentation for a given part of the code.
|
|
822
|
+
|
|
823
|
+
###
|
|
824
|
+
<a name="async-write-docs-by-parts-function"></a> Async Write Docs By Parts Function
|
|
825
|
+
The `async_write_docs_by_parts` function asynchronously generates documentation for a given part of the code.
|
|
826
|
+
|
|
827
|
+
###
|
|
828
|
+
<a name="gen-doc-parts-function"></a> Gen Doc Parts Function
|
|
829
|
+
The `gen_doc_parts` function generates documentation for the given code by splitting it into parts.
|
|
830
|
+
|
|
831
|
+
###
|
|
832
|
+
<a name="async-gen-doc-parts-function"></a> Async Gen Doc Parts Function
|
|
833
|
+
The `async_gen_doc_parts` function asynchronously generates documentation for the given code by splitting it into parts.
|
|
834
|
+
|
|
835
|
+
###
|
|
836
|
+
<a name="sorting-module-functionality"></a> Sorting Module Functionality
|
|
837
|
+
The sorting module is responsible for ordering the documentation fragments based on their semantic meaning. It takes a dictionary of fragments as input, where each key is a unique identifier (anchor name) and the value is the corresponding fragment text.
|
|
838
|
+
|
|
839
|
+
###
|
|
840
|
+
<a name="code-mix-module-functionality"></a> Code Mix Module Functionality
|
|
841
|
+
The code mix module is responsible for building the repository content by traversing the directory tree and writing the file contents to an output file.
|
|
842
|
+
|
|
843
|
+
###
|
|
844
|
+
<a name="compressor-module-functionality"></a> Compressor Module Functionality
|
|
845
|
+
The compressor module is responsible for compressing input data using a provided model and project settings.
|
|
846
|
+
|
|
847
|
+
###
|
|
848
|
+
<a name="visible-interactions"></a> Visible Interactions
|
|
849
|
+
The logging component interacts with the `BaseLogger` class to log messages. The progress tracking component interacts with the `BaseProgress` class to track progress. The installation scripts interact with the file system to create the necessary files and directories.
|
|
850
|
+
|
|
851
|
+
##
|
|
852
|
+
<a name="visible-interactions-1"></a> Visible Interactions
|
|
853
|
+
The code mix module interacts with the following components:
|
|
854
|
+
|
|
855
|
+
* **Logger**: The code mix module uses the `BaseLogger` class to log information about the repository structure and file contents.
|
|
856
|
+
|
|
857
|
+
###
|
|
858
|
+
<a name="visible-interactions-2"></a> Visible Interactions
|
|
859
|
+
This function interacts with the `Model` and `ProjectSettings` modules.
|
|
860
|
+
|
|
861
|
+
###
|
|
862
|
+
<a name="visible-interactions-3"></a> Visible Interactions
|
|
863
|
+
This function interacts with the `AsyncModel` and `global_info` modules.
|
|
864
|
+
|
|
865
|
+
###
|
|
866
|
+
<a name="visible-interactions-4"></a> Visible Interactions
|
|
867
|
+
This function interacts with the `Model`, `ProjectSettings`, and `BaseProgress` modules.
|
|
868
|
+
|
|
869
|
+
###
|
|
870
|
+
<a name="visible-interactions-5"></a> Visible Interactions
|
|
871
|
+
This function interacts with the `AsyncModel`, `global_info`, and `BaseProgress` modules.
|
|
872
|
+
|
|
873
|
+
###
|
|
874
|
+
<a name="technical-logic-flow"></a> Technical Logic Flow
|
|
875
|
+
1. The user runs the installation script to create the necessary files and directories.
|
|
876
|
+
2. The logging component is used to log messages in the system.
|
|
877
|
+
3. The progress tracking component is used to track the progress of tasks in the system.
|
|
878
|
+
4. The user can configure the logging and progress tracking components using the `autodocconfig.yml` file.
|
|
879
|
+
|
|
880
|
+
###
|
|
881
|
+
<a name="technical-logic-flow-1"></a> Technical Logic Flow
|
|
882
|
+
The technical logic flow of the code mix module can be described as follows:
|
|
883
|
+
|
|
884
|
+
1. The `CodeMix` class initializes the root directory and ignore patterns.
|
|
885
|
+
2. The `should_ignore` method checks if a file or directory should be ignored based on the ignore patterns.
|
|
886
|
+
3. The `build_repo_content` method traverses the directory tree and writes the file contents to an output file.
|
|
887
|
+
4. The repository structure and file contents are written to the output file.
|
|
888
|
+
|
|
889
|
+
###
|
|
890
|
+
<a name="technical-logic-flow-2"></a> Technical Logic Flow
|
|
891
|
+
1. The function takes in several parameters: `part`, `model`, `project_settings`, `prev_info`, and `language`.
|
|
892
|
+
2. It initializes a prompt for the model, including the language and project settings.
|
|
893
|
+
3. The function generates documentation for the given part using the model.
|
|
894
|
+
|
|
895
|
+
###
|
|
896
|
+
<a name="technical-logic-flow-3"></a> Technical Logic Flow
|
|
897
|
+
1. The function takes in several parameters: `part`, `async_model`, `global_info`, `semaphore`, `prev_info`, `language`, and `update_progress`.
|
|
898
|
+
2. It initializes a prompt for the model, including the language and global information.
|
|
899
|
+
3. The function generates documentation for the given part using the async model.
|
|
900
|
+
|
|
901
|
+
###
|
|
902
|
+
<a name="technical-logic-flow-4"></a> Technical Logic Flow
|
|
903
|
+
1. The function takes in several parameters: `full_code_mix`, `max_symbols`, `model`, `project_settings`, `language`, and `progress_bar`.
|
|
904
|
+
2. It splits the input code into parts based on the `max_symbols` limit.
|
|
905
|
+
3. The function generates documentation for each part using the `write_docs_by_parts` function.
|
|
906
|
+
|
|
907
|
+
###
|
|
908
|
+
<a name="technical-logic-flow-5"></a> Technical Logic Flow
|
|
909
|
+
1. The function takes in several parameters: `full_code_mix`, `global_info`, `max_symbols`, `model`, `language`, and `progress_bar`.
|
|
910
|
+
2. It splits the input code into parts based on the `max_symbols` limit.
|
|
911
|
+
3. The function generates documentation for each part using the `async_write_docs_by_parts` function.
|
|
912
|
+
|
|
913
|
+
###
|
|
914
|
+
<a name="data-contract"></a> Data Contract
|
|
915
|
+
The following data contract is available:
|
|
916
|
+
| Entity | Type | Role | Notes |
|
|
917
|
+
| --- | --- | --- | --- |
|
|
918
|
+
| `log_message` | str | Input | The log message to be logged. |
|
|
919
|
+
| `log_level` | int | Input | The log level of the message. |
|
|
920
|
+
| `task_name` | str | Input | The name of the task. |
|
|
921
|
+
| `total_length` | int | Input | The total length of the task. |
|
|
922
|
+
| `progress` | int | Output | The progress of the task. |
|
|
923
|
+
|
|
924
|
+
###
|
|
925
|
+
<a name="data-contract-1"></a> Data Contract
|
|
926
|
+
The data contract of the code mix module can be described in the following table:
|
|
927
|
+
|
|
928
|
+
| Entity | Type | Role | Notes |
|
|
929
|
+
| --- | --- | --- | --- |
|
|
930
|
+
| `root_dir` | str | Input | The root directory of the repository. |
|
|
931
|
+
| `ignore_patterns` | list[str] | Input | A list of patterns to ignore when traversing the directory tree. |
|
|
932
|
+
| `output_file` | str | Output | The file path where the repository content will be written. |
|
|
933
|
+
|
|
934
|
+
###
|
|
935
|
+
<a name="data-contract-2"></a> Data Contract
|
|
936
|
+
| Entity | Type | Role | Notes |
|
|
937
|
+
| --- | --- | --- | --- |
|
|
938
|
+
| `part` | str | Input | The part of the code to generate documentation for. |
|
|
939
|
+
| `model` | Model | Input | The model used to generate documentation. |
|
|
940
|
+
| `project_settings` | ProjectSettings | Input | The project settings used to generate documentation. |
|
|
941
|
+
| `prev_info` | str | Input | The previous documentation generated. |
|
|
942
|
+
| `language` | str | Input | The language used to generate documentation. |
|
|
943
|
+
| `answer` | str | Output | The generated documentation. |
|
|
944
|
+
|
|
945
|
+
##
|
|
946
|
+
<a name="data-contract-3"></a> Data Contract
|
|
947
|
+
| Entity | Type | Role | Notes |
|
|
948
|
+
| --- | --- | --- | --- |
|
|
949
|
+
| `part` | str | Input | The part of the code to generate documentation for. |
|
|
950
|
+
| `async_model` | AsyncModel | Input | The async model used to generate documentation. |
|
|
951
|
+
| `global_info` | str | Input | The global information used to generate documentation. |
|
|
952
|
+
| `semaphore` | Semaphore | Input | The semaphore used to control the async process. |
|
|
953
|
+
| `prev_info` | str | Input | The previous documentation generated. |
|
|
954
|
+
| `language` | str | Input | The language used to generate documentation. |
|
|
955
|
+
| `update_progress` | Function | Input | The function used to update the progress. |
|
|
956
|
+
| `answer` | str | Output | The generated documentation. |
|
|
957
|
+
|
|
958
|
+
##
|
|
959
|
+
<a name="data-contract-4"></a> Data Contract
|
|
960
|
+
| Entity | Type | Role | Notes |
|
|
961
|
+
| --- | --- | --- | --- |
|
|
962
|
+
| `full_code_mix` | str | Input | The input code to generate documentation for. |
|
|
963
|
+
| `max_symbols` | int | Input | The maximum number of symbols per chunk. |
|
|
964
|
+
| `model` | Model | Input | The model used to generate documentation. |
|
|
965
|
+
| `project_settings` | ProjectSettings | Input | The project settings used to generate documentation. |
|
|
966
|
+
| `language` | str | Input | The language used to generate documentation. |
|
|
967
|
+
| `progress_bar` | BaseProgress | Input | The progress bar used to track the progress. |
|
|
968
|
+
| `result` | str | Output | The generated documentation. |
|
|
969
|
+
|
|
970
|
+
##
|
|
971
|
+
<a name="data-contract-5"></a> Data Contract
|
|
972
|
+
| Entity | Type | Role | Notes |
|
|
973
|
+
| --- | --- | --- | --- |
|
|
974
|
+
| `full_code_mix` | str | Input | The input code to generate documentation for. |
|
|
975
|
+
| `global_info` | str | Input | The global information used to generate documentation. |
|
|
976
|
+
| `max_symbols` | int | Input | The maximum number of symbols per chunk. |
|
|
977
|
+
| `model` | AsyncModel | Input | The async model used to generate documentation. |
|
|
978
|
+
| `language` | str | Input | The language used to generate documentation. |
|
|
979
|
+
| `progress_bar` | BaseProgress | Input | The progress bar used to track the progress. |
|
|
980
|
+
| `result` | str | Output | The generated documentation. |
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|