Generate a README from your project files using LLM
Project description
Docufy: AI-Powered README Generator
Description
Docufy is a command-line tool that leverages the power of the Gemini Pro model to automatically generate comprehensive README files for your software projects. By analyzing your project's file structure and code, Docufy intelligently creates a well-structured README, including a project description, installation instructions, usage examples, features overview, and file structure summary. It also supports excluding specific files and directories, and specifying file extensions to include.
Fun fact: This documentation was auto generated by docufy
Installation
-
Install the package:
pip install docufy
Note: You might need to configure your
PYTHONPATHif the script is not found after installation. -
Obtain a Gemini API Key:
- Go to the Google AI Studio and create an API key.
-
Set the Gemini API Key:
You can set the API Key using the
--apikeyargument or letdocufyprompt you for it. The API Key will be stored securely in a.envfile.
Usage
To generate a README file for your project, navigate to your project's root directory in the terminal and run:
docufy --path . --out README.md
--path: Specifies the path to your project directory. Defaults to the current directory (.).--out: Specifies the output file name for the generated README. Defaults toREADME.md.--apikey: (Optional) Specifies your Gemini API key directly. If not provided, Docufy will prompt you for it and store it securely.--include: (Optional) Specifies a list of file extensions to include for analysis. Defaults to a common set of code extensions (.py,.js,.jsx,.ts,.tsx,.mjs,.cjs,.json).--exclude: (Optional) Specifies a list of files or directories to exclude from analysis. Supports glob patterns for more flexible exclusion rules.--model: (Optional) Specifies the Gemini model to use. Defaults togemini-2.0-flash.--delete-key: (Optional) Deletes the stored Gemini API key from the .env file.
Examples:
-
Generate a README for the current directory:
docufy --path .
-
Generate a README with a specific output file name:
docufy --path . --out my_project_readme.md
-
Exclude specific files and directories:
docufy --path . --exclude "node_modules/" "*.log" ".DS_Store"
-
Include only Python and JavaScript files:
docufy --path . --include ".py" ".js"
-
Delete the stored API key:
docufy --delete-key
Features Overview
- Automated README Generation: Automatically creates a comprehensive README file based on your project's code.
- AI-Powered Analysis: Uses the Gemini Pro model to understand your project's purpose and functionality.
- Customizable: Allows you to specify file extensions to include and files/directories to exclude.
- Secure API Key Storage: Securely stores your Gemini API key in a
.envfile (if not provided directly). - .readmeignore Support: Respects
.readmeignorefiles for specifying files and directories to exclude from analysis, similar to.gitignore. - Text File Detection: Only includes text-based files for analysis to avoid processing binary files.
File Structure
The docufy package has the following structure:
docufy/
├── __init__.py # Package initialization and entry point
├── ai_analysis.py # Contains AI analysis functions (e.g., language detection)
├── generate_readme.py # Contains the main logic for generating the README
├── utils.py # Utility functions (e.g., API key handling, file type checking)
└── .env # (Optional) Stores the Gemini API key
Important Notes
- API Key Security: The Gemini API key is stored in a
.envfile. Ensure this file is not committed to version control (add it to your.gitignore). - Gemini Pro Usage: Generating README files requires the Gemini Pro model, which may have usage limits or costs associated with it. Refer to the Google AI Studio documentation for details.
- Context Size Limit: The tool limits the total code size sent to the Gemini model to avoid exceeding context window limits. If your project is very large, not all code may be included in the analysis. Consider using
--includeand--excludeto narrow down the code processed. - .readmeignore file: You can create a
.readmeignorefile in your project root directory to specify files and directories that should be excluded from the README generation process. The format is the same as.gitignore. - The quality of the generated README depends on the clarity and structure of your source code.
- Consider reviewing and editing the generated README to ensure accuracy and completeness.
Project details
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 docufy-1.3.2.tar.gz.
File metadata
- Download URL: docufy-1.3.2.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5d4e89ea71eec7d2371b046b6f1178d096b587dac63959000e24a2f96fcfc2e
|
|
| MD5 |
15638b618af6d2d4defa95b81388ddc1
|
|
| BLAKE2b-256 |
0ba45380be2fbd197fa9072785735cdc8b4b0267c73afe6cec697c0c850e14f5
|
File details
Details for the file docufy-1.3.2-py3-none-any.whl.
File metadata
- Download URL: docufy-1.3.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
562aad967c62d19782688b05740a94790ab8802bfecf1141bb81e2180f95bced
|
|
| MD5 |
398f0967708e4255d5f670135d268114
|
|
| BLAKE2b-256 |
42cfeef095b1676750864208629bef0280e6ad8d697991519ab59a2fdc355a68
|