Skip to main content

Use ChatGPT to generate a well-formatted README based on your code

Project description

*This readme is generated by command: `gpt-readme --path="./" --demand="let user know gpt-readme is a shell command that can be directly used in commandline. Add detailed commandline usage of gpt-readme. Let user know they can install gpt-readme from pip, or from source github repo gusye1234/gpt-readme" --language="english"`*

gpt-readme

Introduction

The gpt-readme module is a Python code library that generates README files based on code repositories. It provides a convenient way to automatically generate documentation for code projects. By analyzing the code files and directories in a repository, gpt-readme can generate a README file that includes summaries of the code structure, files, and other relevant information.

Get Started

To install gpt-readme, you can use either of the following methods:

  1. Install from PyPI using pip:

    pip install gpt-readme
    
  2. Install from the source GitHub repository:

    git clone https://github.com/gusye1234/gpt-readme.git
    cd gpt-readme
    python setup.py install
    

Once installed, you can use the gpt-readme command directly in the command line.

Command-line Usage

The gpt-readme command-line tool provides various options to customize the README generation process. Here is an example usage:

gpt-readme --path ./code --exts py,java --language english --demand "No false summary is allowed" --out ./readme.md --cache 1 --agree

The available command-line options include:

  • --path: The path to the code repository.
  • --exts: The file extensions to include in the README generation.
  • --language: The language used in the README file.
  • --demand: Additional requirements for the README generation.
  • --out: The output path for the generated README file.
  • --cache: Caching options for improved performance.
  • --agree: Agreement to send code to OpenAI.

Features

The gpt-readme module supports the following main features:

  1. Summarizing directories and files: gpt-readme can analyze the code repository and generate summaries of directories and files. This helps users understand the structure and contents of the codebase.

  2. Generating README files: Based on the analysis of the code repository, gpt-readme can generate a README file that includes the summarized information. This saves time and effort in manually creating documentation.

Implementation

The gpt-readme module consists of the following submodules and code files:

  • __init__.py: Imports the main function and defines metadata about the code repository.
  • __main__.py: Serves as the entry point for the codebase and executes the main function.
  • constants.py: Defines constants and a function for generating a readme header.
  • dir_summary.py: Implements functionality for summarizing directories and files in a code repository.
  • file_summary.py: Provides functionality for summarizing code files.
  • main.py: Uses ChatGPT to generate a README file based on code.
  • prompts.py: Contains string constants used as prompts for generating documentation.
  • utils.py: Provides utility functions for the gpt-readme codebase.

Acknowledgement

The gpt-readme module depends on the following external modules:

  • setuptools: Used for packaging and distributing the gpt-readme package.
  • openai: Required for the functionality of the gpt-readme package.
  • rich: Required for the functionality of the gpt-readme package.

Special thanks to the authors and contributors of these external modules for their valuable contributions.

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

gpt-readme-0.0.5.tar.gz (10.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page