A tool for generating documentation
Project description
Docgenie: Documentation Generation Tool
Docgenie is a powerful command-line tool that leverages advanced AI models to automatically generate comprehensive documentation for your projects. It supports various documentation types, including general documentation, README files, API documentation, and code model explanations.
Installation
Docgenie requires Python 3.8.1 or higher. To install it, run the following command:
pip install docgenie
Setup
-
Initialize Configuration: Run
docgenie initto create adocgenie.config.jsonfile in your project root directory. This file contains the configuration settings for Docgenie. -
Configure the AI Agent:
- Custom API: Select
custom-apias the AI agent if you want to use your own API endpoint for documentation generation. You will need to provide the API URL, headers, and query parameters. - Gemini: Select
gemini-1.5-flashas the AI agent to leverage Google's Gemini model. You will need to set theDOCGENIE_MODEL_API_KEYenvironment variable to your Gemini API key.
- Custom API: Select
-
Define Documentation Rules:
- Type: Select the type of documentation you want to generate for each rule (e.g.,
general,readme,api,model). - Directory: Specify the directory where the code files reside.
- Include Patterns: Define patterns for files to be included in the documentation generation process (wildcards
*and?are supported). - Exclude Patterns: Define patterns for files to be excluded from the documentation generation process (wildcards
*and?are supported). - Output Directory: Specify the directory where the generated documentation files will be saved.
- Search Depth: Set the depth of the directory search for code files.
- Output Format: Choose the output format for the documentation (e.g.,
markdown,html,text). - Prompt: Add any additional instructions or context for the AI agent.
- Type: Select the type of documentation you want to generate for each rule (e.g.,
Example docgenie.config.json:
{
"root_dir": ".",
"agent": {
"name": "gemini-1.5-flash",
"config": {}
},
"rules": [
{
"type": "readme",
"dir": "src",
"include": ["*.py"],
"exclude": [],
"output": "docs",
"depth": 3,
"format": "markdown",
"prompt": ""
}
]
}
Usage
To generate documentation, run the following command:
docgenie build
Docgenie will process your code files based on the defined rules and generate documentation in the specified output directory.
Code Structure
The code is structured as follows:
- docgenie/cli/init.py: Defines the command-line interface (CLI) for Docgenie, including the
buildandinitcommands. - docgenie/models/init.py: Defines the supported AI models.
- docgenie/models/gemini.py: Implements the Gemini model for documentation generation.
- docgenie/models/custom_api.py: Implements the Custom API model for documentation generation.
- docgenie/main.py: Contains the core logic for loading configuration, generating prompts, and generating documentation.
- docgenie/prompts.py: Defines the prompts used to interact with the AI models.
- docgenie/utils/file.py: Provides utility functions for reading and writing files.
- docgenie/utils/patterns.py: Provides functionality for matching files based on patterns.
- docgenie/utils/languages.py: Provides functions to extract import paths from code based on the language.
- docgenie/model.py: Handles the loading and interaction with AI models.
- docgenie/utils/terminal.py: Provides functions for displaying colored text in the terminal.
Configuration Parameters
docgenie.config.json:
root_dir: Specifies the root directory of the project. Defaults to the current directory.agent:name: The name of the AI agent to use. Supported values:gemini-1.5-flash,custom-api.config:- For
custom-api:url: The URL of the custom API endpoint.headers: A dictionary of headers to be sent with the API request.query: A dictionary of query parameters to be sent with the API request.
- For
gemini-1.5-flash: No specific configuration parameters are required.
- For
rules: An array of objects representing the documentation rules. Each rule object has the following properties:type: The type of documentation to generate. Supported values:general,readme,api,model.dir: The directory where the code files reside.include: An array of patterns for files to be included in the documentation generation process.exclude: An array of patterns for files to be excluded from the documentation generation process.output: The directory where the generated documentation files will be saved.depth: The depth of the directory search for code files.format: The output format for the documentation. Supported values:markdown,html,text.prompt: Additional instructions or context for the AI agent.
Environment Variables
DOCGENIE_MODEL_API_KEY: The API key for the Gemini model.
Contributing
Contributions are welcome! Please follow the standard contribution guidelines:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and write unit tests.
- Submit a pull request.
License
Docgenie is licensed under the MIT License.
The documentation is generated using AI by docgenie. If you found any issues, please report them to the team.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file docgenie-0.0.2.tar.gz.
File metadata
- Download URL: docgenie-0.0.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
636a1a66f55867bdc7898c340041b0366e02160eab0b78627e98a89e161fadd8
|
|
| MD5 |
69cf803e6f2e52a132669e80f5eb5d52
|
|
| BLAKE2b-256 |
0063614fb10f53615139cb6bb7443019b852bb9c184fc62857fbf6f9397aa7c4
|
File details
Details for the file docgenie-0.0.2-py3-none-any.whl.
File metadata
- Download URL: docgenie-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08dd6436d7c1e470f8ca3b331776a7534348887badf190653c1ac175123efb6e
|
|
| MD5 |
b505be933aaea5a9b3344120c70b3b57
|
|
| BLAKE2b-256 |
15bc44e4fa17d5dcaf7cbcf0edb188e41f15742e6182400035344b403a793998
|