Skip to main content

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

  1. Install the package:

    pip install docufy
    

    Note: You might need to configure your PYTHONPATH if the script is not found after installation.

  2. Obtain a Gemini API Key:

  3. Set the Gemini API Key:

    You can set the API Key using the --apikey argument or let docufy prompt you for it. The API Key will be stored securely in a .env file.

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 to README.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 to gemini-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 .env file (if not provided directly).
  • .readmeignore Support: Respects .readmeignore files 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 .env file. 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 --include and --exclude to narrow down the code processed.
  • .readmeignore file: You can create a .readmeignore file 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.

Metadata

Release files for docufy 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docufy 1.3.2
File Size Uploaded Provenance Actions
docufy-1.3.2.tar.gz 8.2 kB Without provenance Details for docufy-1.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docufy 1.3.2
File Interpreter ABI Platform Actions
docufy-1.3.2-py3-none-any.whl Python 3 none any Details for docufy-1.3.2-py3-none-any.whl

Total release size: 18.1 kB

Release files / docufy-1.3.2.tar.gz

Download URL docufy-1.3.2.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b5d4e89ea71eec7d2371b046b6f1178d096b587dac63959000e24a2f96fcfc2e
BLAKE2b-256 checksum
How to use checksums
0ba45380be2fbd197fa9072785735cdc8b4b0267c73afe6cec697c0c850e14f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / docufy-1.3.2-py3-none-any.whl

Download URL docufy-1.3.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
562aad967c62d19782688b05740a94790ab8802bfecf1141bb81e2180f95bced
BLAKE2b-256 checksum
How to use checksums
42cfeef095b1676750864208629bef0280e6ad8d697991519ab59a2fdc355a68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for docufy 1.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page