HimWriter-README_Builder is a tool that leverages the Google Gemini API to automatically generate README.md files. This project aims to assist developers in quickly creating project documentation by allowing users to customize the tone, language, and sections to include, significantly simplifying the README writing process. The tool features a graphical user interface (GUI) that is intuitive and easy to use, making it suitable for all types of software projects.
- Automatic README.md Generation: Generates structured README.md files based on project file contents.
- Multiple Languages and Tones: Supports various languages (e.g., Traditional Chinese, English) and tones (e.g., formal, technical), adjustable to meet project needs.
- Gemini Model Selection: Allows users to choose different Google Gemini models (e.g.,
gemini-pro,gemini-1.5-flash) for content generation. - Customizable Sections: Users can specify required sections in the README, such as file structure, installation instructions, etc.
- Graphical User Interface (GUI): Offers a user-friendly GUI for an enhanced operational experience.
- Automatic Folder Ignoring: Utilizes the Gemini API to analyze the project directory structure and automatically suggest ignoring non-essential folders like virtual environments or build outputs, improving README accuracy.
- Error Handling and Retry Mechanism: Implements error handling for Gemini API quota limits with a retry mechanism to enhance tool stability.
- Python 3.7 or higher
- pip (Python package management tool)
-
Download the Project:
cd HimWriter-README_Builder -
Install Dependencies: Run the following command in the project root directory to install the required Python packages:
pip install -r requirements.txt
-
Set Up Gemini API Key:
- Visit Google AI Studio to obtain a Gemini API key.
- Open the
config.pyfile in the project directory. - Replace
API_KEYwith your obtained Gemini API key:API_KEY = "YOUR_ACTUAL_API_KEY"
-
Run the Application: Execute the following command in the project root directory to launch the GUI application:
python main.py
-
Configure Parameters:
- Project Path: Click the "Browse" button or manually enter the root directory path of your project.
- Model: Select the desired Gemini model from the "Model" dropdown menu. Default options include
gemini-pro,gemini-1.5-pro,gemini-1.5-flash,gemini-2.0-flash-thinking-exp-01-21. - Tone: Choose the tone for the README from the "Tone" dropdown menu, such as "formal," "casual," "technical," etc. You can also select "other" and enter a custom tone in the field below.
- Language: Select the README language from the "Language" dropdown menu, such as "Traditional Chinese," "English," etc.
- Required Sections: Check the sections you want the README to include, such as "File Structure," "Detailed Installation," "Introduction," "Project Structure," etc. You can also check "Other" and enter additional section names as needed.
-
Generate README: Click the "Generate" button to start the process. The application will read your project files and call the Gemini API to generate the README content. During generation, the "Execution Status" area will display progress messages, and the "Generated Result" area will show the generated README content (in Markdown format).
-
Save README: After verifying the README content in the "Generated Result" area, click the "Save" button. Choose the path and filename where you want to save the README (default is
generated/README.md) to store it locally.
In the config.py file, you can modify the following options:
MODELS: This list defines the available Gemini models. You can add or remove model names as needed.SUPPORTED_LANGUAGES: This list defines the supported README languages. You can add or remove language names as needed.TONES: This list defines the default tone options for the README. You can add or remove tone options as needed.
- Ensure the Gemini API key is correctly set before first use.
- The quality of the generated README depends on the Gemini model's capabilities and the project file contents. It’s recommended to review and edit the generated content as necessary.
- Ensure the selected model matches the API-supported model types, or the tool will not function.
- If you encounter a Gemini API quota limit error (HTTP 429), the application will automatically retry, and related messages will appear in the "Execution Status" area. Please be patient or try again later.
- If there are issues with the exported README.md, please copy the raw generated content from the GUI and modify it manually. We are currently working on fixing this issue.
If you have suggestions for new features or encounter bugs, please contact us.
Please read the LICENSE file.