UI docomentation generator
Project description
Quick Documentation Generator Overview
Quick documentation is an interactive tool for generating project documentation. It allows users to easily create documentation by providing a user-friendly interface and integrating with various programming languages and APIs. This tool aims to simplify the process of creating comprehensive documentation for your projects, saving time and effort.
Features
- User-friendly graphical user interface.
- Support for different programming languages and programming environments.
- Advanced and accurate syntax highlighting.
- Customizable prompts for a tailored documentation experience.
Structure
The codebase is organized in different directories and files for easy navigation and maintenance. Here's an overview of the main components:
pyproject.toml: Project configuration file, defining dependencies, scripts, and other project-related settings.backend.py: Main backend file that handles communication with APIs and logic for generating documentation.DataHandler.py: A class responsible for managing languages, versions, and other data-related operations.AutoDock.py: A class for handling user input and generating documentation based on the provided project-specific data.GUI/index.html: The main HTML file for the graphical user interface.GUI/script.js: Contains JavaScript code to manage user inputs and interactions with the frontend.GUI/style.css: Defines the style for the user interface.visual.py: A script that creates and initializes the GUI and handles the communication between frontend and backend.
Usage
To use the Quick documentation generator, follow these steps:
- Install the required dependencies by running
pip install -r requirements.txt. - Launch the application by running
python visual.pyin your terminal or command prompt. - The tool will open a graphical user interface in the web browser.
- Enter the required information (project name, project path, ignored files, and prompts) in the appropriate fields.
- Choose the desired programming languages and GPT version from the respective dropdowns.
- Click the "Gen doc" button to generate the documentation.
The generated documentation will be saved in the specified project directory, depending on your project requirements and settings.
Quick-doc-py UI Documentation
Usage
To use Quick-doc-py UI, please follow the steps below:
- Install the required dependencies by running the command:
pip install -r requirements.txt
-
Open your terminal or command prompt and navigate to the root directory of your Python project.
-
Run the following command to generate the documentation:
python -m quick_doc_ui.visual
gen-doc-ui
- Follow the on-screen prompts to generate your documentation.
Methods
This section describes the methods available within the Quick-doc-py UI.
gen-doc-ui
This command generates the documentation for your Python project. It is defined in pyproject.toml.
Command: gen-doc-ui
Description: Generates documentation for your Python project.
Quick-doc-ui Backend Module Documentation
This module provides the functionality to generate documentation for a given project using Quick-doc-py. The main classes provided by this module are AutoDock and DataHandler.
AutoDock Class
The AutoDock class is responsible for setting up the required parameters for the Quick-doc-py and generating the documentation.
Constructor
def __init__(self,
name_project: str,
ignore: list[str],
root_dir: str,
languages: list[str],
with_git: bool = True,
gpt_version: str = "gpt-3.5-turbo",
provider: str = "DarkAI",
general_prompt: str = "",
default_prompt: str = ""
):
-
name_project: Name of the project for which the documentation needs to be generated. -
ignore: List of files/folders to ignore while scanning for source code. -
root_dir: path to the root directory of the project. -
languages: List of languages to be included for generating documentation. -
with_git(optional): This parameter is set toTrueif git information is to be used. Default value isTrue. -
gpt_version(optional): GPT version for generating documentation. Default value is "gpt-3.5-turbo". -
provider(optional): Provider name for generating documentation. Default value is "DarkAI". -
general_prompt(optional): General prompt for generating documentation. -
default_prompt(optional): Default prompt for generating documentation.
Methods
def gen_doc(self):
- This method sets up the required arguments and calls Quick-doc-py to generate documentation for the given project.
DataHandler Class
The DataHandler class provides information about supported languages and versions.
Methods
def get_active_providers(self, gpt_version: str):
def support_languages(self):
def support_versions(self):
-
get_active_providers: Returns the active providers for the given GPT version. -
support_languages: Returns the list of supported languages. -
support_versions: Returns the list of supported GPT versions.
Example Usage
data_handler = DataHandler()
active_providers = data_handler.get_active_providers("gpt-3.5-turbo")
supported_languages = data_handler.support_languages()
supported_versions = data_handler.support_versions()
- This code initializes the DataHandler class and retrieves the list of active providers, supported languages, and supported versions.
AutoDock Usage Example
from quick_doc_ui.backend import AutoDock
auto_dock = AutoDock(
name_project="Test Project UI",
ignore=[".venv"],
root_dir="C:/Users/sinic/Python_Project/Quick-doc-py UI/",
languages=["en"]
)
auto_dock.gen_doc()
- This code initializes the AutoDock class with provided parameters and generates documentation for the given project.
Please note that this documentation is a supplementary addition to the existing document.
QuickDocPy GUI
This guide describes the usage and methods of the QuickDocPy GUI application.
Usage
To use the QuickDocPy GUI, follow these steps:
-
Open the
index.htmlfile in a web browser. -
Input the project details:
- Name of project: Specify the name of your project.
- Project path: Enter the directory path for your project.
- Ignore file: If you want to specify an ignore file for your project, do so here.
- General prompt: Write a general prompt to describe your project's documentation.
- Default prompt: Write a default prompt for any parts of the documentation you would like to automatically generate.
-
Select the programming language for your project from the dropdown menu.
-
Choose the GPT version from the dropdown menu within the "Chose GPT version" section.
-
Click the "Gen doc" button to generate the documentation for your project.
This will create an HTML document containing the generated documentation for your specified project, populated with the content provided by the GPT model.
Method Descriptions
gen_doc():- This function is called when the "Gen doc" button is clicked. It generates the project documentation using the provided prompts and GPT model.
Please note that this documentation is an addition to the existing documentation and may not cover all aspects or configurations of the application.
Quick-doc UI Script Documentation
This documentation provides an overview of the script's usage, explaining the different methods and their respective functionalities.
Table of Contents
Window.onload
This function initializes the window dimensions and calls the getInfo method to retrieve and display info from another extension.
window.onload = function () {
window.resizeTo(500, 800);
info = getInfo();
console.log(info.languages);
}
getInfo
The getInfo function communicates with an external extension, retrieves information using the eel.get_info() method, and parses the obtained information into separate components for further processing. It handles errors that may occur during the data retrieval.
async function getInfo() {
try {
const info = await eel.get_info()();
console.log(info);
console.log("Languages:", info.languages);
console.log("Versions:", info.versions);
add_languages(info.languages)
add_gpt(info.versions)
} catch (error) {
console.error("Error:", error);
}
}
add_languages
The add_languages function populates a scrolling list on the GUI. It creates individual language elements and assigns each one a checkbox. These elements are added onto the designated parent DOM node.
function add_languages(langs){
parent = document.querySelector(".input .current .left")
for (i in langs){
language = document.createElement("div")
language.classList.add("language");
name_class = document.createElement("div");
name_class.classList.add("name");
p_text = document.createElement("p");
p_text.innerHTML = langs[i]
name_class.appendChild(p_text)
language.appendChild(name_class)
tick_class = document.createElement("div");
tick_class.classList.add("tick");
tick = document.createElement("input");
tick.setAttribute("type", "checkbox")
tick.setAttribute("lang", langs[i])
tick_class.appendChild(tick)
language.appendChild(tick_class)
parent.appendChild(language)
}
}
add_gpt
The add_gpt function populates a dropdown menu on the GUI. It iterates over a list of gpt_versions, creates option elements, and appends them to the designated parent DOM node.
function add_gpt(gpt_vesions){
parent = document.querySelector(".input .current .right select")
for (i in gpt_vesions){
op = document.createElement("option")
op.setAttribute("value", gpt_vesions[i])
op.innerHTML = gpt_vesions[i]
parent.appendChild(op)
}
}
gen_doc
The gen_doc function collects user input from the GUI (project_name, path, ignored_files, gpt, languages, and prompts) and passes the collected information to the external extension to generate documentation.
function gen_doc(){
name_project = document.getElementById("name").value
path = document.getElementById("path").value
ignore = document.getElementById("ignore").value
g_prompt = document.getElementById("g_prompt").value
d_prompt = document.getElementById("d_prompt").value
gpt = document.getElementById("gpt").value
languages = get_lang()
eel.gen_doc(name_project, path, ignore, languages, g_prompt, d_prompt, gpt)
}
get_lang
The get_lang function retrieves the selected languages from the GUI. It iterates over input elements within a specific DOM node and returns the language values of the checked inputs.
function get_lang(){
inputs = document.querySelectorAll(".input .current .left .language .tick input")
ex = []
for (i in inputs){
if (inputs[i].checked){
ex.push(inputs[i].lang)
}
}
return ex
}
Feel free to use and customize this documentation for further clarity and application-specific instructions.
style.css Documentation
This style.css file is responsible for the styling of the Quick-doc-py UI (User Interface) application, providing users with a modern and visually appealing experience.
Usage
To use this CSS file in your project, simply import it into your HTML file using the following line in the <head> section of your HTML document:
<link rel="stylesheet" href="./style.css">
Ensure that you place the style.css file at the appropriate location relative to your HTML file. In this example, it is assumed to be in the same directory.
Methods
No methods are present in this CSS file.
Please note that this documentation is an addition to the full documentation of the style.css file, focusing primarily on usage and describing the methods. For further details on the styling techniques used, please refer to the full documentation or additional resources, as needed.
visual.py Documentation
This document describes the usage and functionality of the visual.py file in Markdown format using the Google style guide. The file is part of the Quick-doc-py UI project.
Usage
The visual.py file is a Python module designed to interact with the graphical user interface (GUI) built using Eel. It exposes various methods to generate documentation based on user input.
Requirements
Ensure that you have the following packages installed:
eelfor embedding web-based GUIs in Pythonbackendfor handling data and generating documentation
To install the required packages, you can use the following command:
pip install eel
If the backend module is not in the same directory, you need to import it from the relative path as shown in the code below:
from . import backend
Functions and Mets
##hod## get_info()
The get_info() function retrieves the list of supported programming languages and versions available for document generation. This method is exposed to the GUI through Eel and can be called using the following JavaScript code:
window.onloaded('get_info');
The returned data object includes the following fields:
{
"languages": [list_of_supported_languages],
"versions": [list_of_supported_versions]
}
gen_doc()
The gen_doc() function generates documentation based on user input. It requires the following parameters:
name: The name of the project for which documentation is generated.root_dir: The root directory where the project files are located.ignore: A list of file patterns to ignore during the documentation generation.languages: A list of programming languages to be included in the documentation.g_prompt: The general prompt for the language model to use during documentation generation.d_prompt: The default prompt for the language model to use during documentation generation.version: The specific version of the language model to use.
The function initializes an instance of AutoDock with the provided parameters and calls its gen_doc() method to generate the documentation.
Running the GUI
To start the GUI, you need to call the main() function. This will initialize the Eel module, specifying the location of the HTML file (index.html) and the desired window size and mode.
if __name__ == '__main__':
current_dir = os.path.dirname(os.path.abspath(__file__))
eel.init(os.path.join(current_dir, 'GUI'))
eel.start("index.html", port=809, size=(400, 300), mode="chrome")
Conclusion
The visual.py file provides a Python interface to interact with the Quick-doc-py UI's graphical user interface. It allows users to retrieve information about supported languages and versions as well as generate documentation based on provided project parameters.
Feel free to use and modify this documentation as needed, while keeping the required formatting and style.
quick_doc_ui
Welcome to the Quick-doc UI Module! This documentation page will guide you through the usage of the methods provided within the __init__.py file of the Quick-doc UI Python project.
Table of Contents
Initialization
To use the Quick-doc UI module, you'll need to initialize an instance of the QuickDocUI class. This will set up the necessary environment for the other methods to function properly.
from quick_doc_ui import QuickDocUI
quick_doc = QuickDocUI()
close_quick_doc
This method is used to close the Quick-doc UI interface.
quick_doc.close_quick_doc()
update_command
This method allows you to replace the current Quick-doc UI command.
quick_doc.update_command(new_command)
new_command: (string) The new command to be added to the Quick-doc UI.- Returns: None
By utilizing the methods provided by this module, you'll be able to effectively control the Quick-doc UI project within your Python environment.
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 quick_doc_ui-1.1.1.tar.gz.
File metadata
- Download URL: quick_doc_ui-1.1.1.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4264c5c505ac0161d28e2fb4ea352574910c89f1938929b18754e9e6c963c075
|
|
| MD5 |
23407f7623b671d11a1933c86dff958b
|
|
| BLAKE2b-256 |
2f281fc8a9ec0c6044a9cf967bf9bb5b55916df4fb01fa1d4f76d6018ead5664
|
File details
Details for the file quick_doc_ui-1.1.1-py3-none-any.whl.
File metadata
- Download URL: quick_doc_ui-1.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd37ac08144412c6e110b24ffa4ae9baf8d3648d22ded2a7edebd98124172ba
|
|
| MD5 |
7fe159131ad8a97d22803f77d0bf4fa4
|
|
| BLAKE2b-256 |
2cc569c657acbb2f44a24c72f34a95ffdee8e6ec65a7bcb812c46f5bb1702728
|