gpt-readme 0.1.2
Use ChatGPT to generate a well-formatted README based on your code
Requires Python: >=3.8


<div align="center">
    <a href="https://github.com/gusye1234/gpt-readme">
      <img src="https://img.shields.io/badge/written_by-gpt_readme-green">
    </a>
    <a href="https://github.com/gusye1234/gpt-readme">
      <img src="https://img.shields.io/badge/could_be-Wrong-red">
    </a>
    <a href="https://pypi.org/project/gpt-readme/">
      <img src="https://img.shields.io/pypi/v/gpt-readme.svg">
    </a>
</div>

*This readme is generated by command:*
```shell
gpt-readme --demand let user know gpt-readme is a shell command. use gpt-readme for the commandline usage, not the python call. You must detail 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 --agree 
```

# gpt-readme

## Introduction
The `gpt-readme` module is designed to automate the generation of well-formatted README files for code repositories using OpenAI's language model. It streamlines the documentation process for developers by summarizing directories and files based on specified parameters, making it easier to create comprehensive documentation for projects.

## Get Started
To install `gpt-readme`, you can choose one of the following methods:

### Installation via pip
You can install `gpt-readme` directly from PyPI using pip:
```bash
pip install gpt-readme
```

### Installation from Source
Alternatively, you can clone the GitHub repository and install it from source:
```bash
git clone https://github.com/gusye1234/gpt-readme.git
cd gpt-readme
pip install .
```

### Command-line Usage
Once installed, you can use the `gpt-readme` command to generate a README file. Here is the command format:
```bash
gpt-readme --path <repo_path> --exts <extensions> --max_dir_entity <number> --language <lang> --model <model> --demand <requirements> --out <output_path> --cache <0 or 1> --agree
```

#### Options:
- `--path`: Path to the repository.
- `--exts`: File extensions to include.
- `--max_dir_entity`: Maximum number of directory entities to process.
- `--language`: Programming language of the code.
- `--model`: OpenAI model to use.
- `--demand`: Specific requirements for the README.
- `--out`: Output path for the generated README.
- `--cache`: Enable or disable caching (0 or 1).
- `--agree`: Agreement flag for terms.

## Feature
The `gpt-readme` module supports the following main features:
- **Directory Summarization**: Recursively summarizes directories and files, providing an overview of the project structure.
- **File Summarization**: Generates summaries for individual code files, enhancing the understanding of code functionality.
- **Customizable Output**: Allows users to specify various parameters to tailor the README generation to their needs.

### Use Cases
- Developers looking to quickly generate documentation for their projects.
- Teams needing consistent and structured README files for better collaboration.
- Open-source contributors wanting to enhance the visibility and usability of their repositories.

## Implementation
The `gpt-readme` module consists of several files, each serving distinct purposes:

- **`setup.py`**: Configures the package and its dependencies.
- **`gpt_readme/__init__.py`**: Initializes the package and imports the main functionality.
- **`gpt_readme/__main__.py`**: Entry point for executing the application.
- **`gpt_readme/constants.py`**: Contains constants and configurations for the module.
- **`gpt_readme/dir_summary.py`**: Implements directory summarization using OpenAI's API.
- **`gpt_readme/file_summary.py`**: Summarizes individual code files and caches results.
- **`gpt_readme/llm.py`**: Provides an asynchronous interface to OpenAI's API.
- **`gpt_readme/main.py`**: Implements the command-line tool for generating README files.
- **`gpt_readme/prompts.py`**: Contains prompt templates for structured documentation.
- **`gpt_readme/utils.py`**: Offers utility functions for various operations.

## Acknowledgement
The `gpt-readme` module utilizes several third-party libraries:
- **`openai`**: For interacting with OpenAI's API to generate text completions.
- **`asyncio`**: For handling asynchronous operations within the module.
- **`argparse`**: For parsing command-line arguments.
- **`rich`**: For enhanced console output, providing a better user experience.

Thank you for using `gpt-readme` to simplify your README generation process!