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. use gpt-readme for the commandline usage, not the python call. Add detailed commandline usage of gpt-readme. Detail the installation process. 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 code library that generates well-formatted README files using OpenAI's GPT-3.5-turbo model. It provides functionality to summarize code repositories, directories, and individual code files. The generated README includes summaries of the code's purpose, functionality, dependencies, and command-line usage.

Get Started

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

  1. Install from PyPI:

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

    git clone https://github.com/gusye1234/gpt-readme.git
    cd gpt-readme
    pip install .
    

To use the gpt-readme module from the command line, you can run the following command:

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

The command-line arguments are as follows:

  • --path: The local path for the code repository or file.
  • --exts: The code extension names to consider.
  • --language: The language for the README.
  • --demand: Additional requirements for the README.
  • --out: The path to save the generated README file.
  • --cache: Whether to cache the code summary.
  • --agree: Whether to allow sending the code to OpenAI.

Features

The gpt-readme module supports the following main features:

  • Summarizing code repositories, directories, and individual code files.
  • Generating well-formatted README files with summaries of code purpose, functionality, dependencies, and command-line usage.

You can use the gpt-readme module in the following scenarios:

  • Documenting code repositories or projects.
  • Generating README files for open-source projects.
  • Providing code summaries for code review or collaboration.

Implementation

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

  • setup.py: Configures the installation and distribution of the gpt-readme package.
  • gpt_readme/__init__.py: Provides metadata information about the module and imports the main module.
  • gpt_readme/__main__.py: Serves as the entry point for the codebase and executes the main function.
  • gpt_readme/constants.py: Defines constants and a function for generating a readme header.
  • gpt_readme/dir_summary.py: Summarizes the contents of a directory using OpenAI's GPT-3.5-turbo model.
  • gpt_readme/file_summary.py: Generates a summary of a given file using the GPT-3.5-turbo model.
  • gpt_readme/main.py: Generates a README file using ChatGPT based on a code repository or file.
  • gpt_readme/prompts.py: Contains string constants used as prompts for generating documentation.
  • gpt_readme/utils.py: Provides utility functions for the codebase.

Please note that if there are no comments or code inputs in a specific submodule or code file, it will be skipped in the implementation summary.

Acknowledgement

The gpt-readme module depends on the following third-party libraries:

  • rich.console: Used for console output formatting.
  • openai: Used for interacting with the OpenAI GPT-3.5-turbo model.
  • os: Used for file and path operations.
  • asyncio: Used for running asynchronous tasks.

Special thanks to the authors and contributors of these libraries 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.1.0.tar.gz (10.6 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