Skip to main content

gptify

gptify is a command-line tool that transforms a Git repository into a single text file or multiple text chunks suitable for use with Large Language Models (LLMs) like ChatGPT. It preserves the file structure and content, enabling LLMs to understand and process the codebase for tasks such as code review, documentation generation, and answering questions about the code. This project is a fork of gptrepo with added features.

Relevance

This tool addresses the challenge of effectively using LLMs with codebases. By converting a repository into a digestible format, gptify allows developers to leverage the power of LLMs for various development tasks. It simplifies the process of feeding code context into LLMs, avoiding size limitations and formatting issues.

Installation

The easiest way to install gptify is using pip:

pip install gptify

Alternatively, you can install it using pipx:

poetry build && pipx install dist/*.whl

You can also uninstall older versions using the provided install script:

./install.sh

Usage

  1. Navigate to the root directory of your Git repository.
  2. Run the gptify command:
gptify

This will generate a file named gptify_output.txt in the current directory containing the formatted repository content. You can then copy and paste the contents of this file into a ChatGPT session.

Options

  • --output <filename>: Specifies the name of the output file (default: gptify_output.txt).
  • --clipboard: Copies the output directly to the clipboard instead of creating an output file.
  • --openfile: Opens the output file after creation using the default system application.
  • --preamble <filepath>: Prepends a custom preamble to the output file. This is useful for providing instructions or context to the LLM.
  • --chunk: Enables chunking of the output into smaller files, useful for handling large repositories that exceed LLM context limits. Used with --max_tokens and --overlap.
  • --max_tokens: Sets the maximum number of tokens per chunk when using the --chunk option (default: 900000). Requires the tiktoken library.
  • --overlap: Sets the number of overlapping tokens between chunks when using the --chunk option (default: 400). Helps maintain context across chunks. Requires the tiktoken library.
  • --output_dir: Specifies the output directory for chunks when using --chunk (default: gptify_output_chunks).

Example with custom output file and preamble:

gptify --output my_repo.txt --preamble instructions.txt

This command will generate my_repo.txt with the processed repository data, prepended with the content of instructions.txt.

Example with chunking:

gptify --chunk --max_tokens 4000 --overlap 200

This will create multiple files in the gptify_output_chunks directory, each containing a chunk of the repository data, with a maximum of 4000 tokens and an overlap of 200 tokens.

Contributing

Contributions are welcome.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for gptify 0.5.0

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

Source distribution (sdist)

Source distribution for gptify 0.5.0
File Size Uploaded
gptify-0.5.0.tar.gz 5.1 kB Details

Built distribution (wheel)

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

Total release size: 11.5 kB

Release files / gptify-0.5.0.tar.gz

Download URL gptify-0.5.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aad37927b05d1d0e550001ec6c4cb4e78944cbf4f3c86e2bee81697f4d0b2844
BLAKE2b-256 checksum
How to use checksums
da28430ceda1bb4b9c5604a4dc75bf0bee1c176b140b158c9e9b31d72cde08a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / gptify-0.5.0-py3-none-any.whl

Download URL gptify-0.5.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
920f9073ba9282e5e033309299062a5910335e69e75d9d3847a119db80a911d5
BLAKE2b-256 checksum
How to use checksums
11e6918a6fc075c508093a17ad957acc2b05af56bb87eb5909260883a8f8f882
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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