Skip to main content

Generate a context file of your whole software project to feed into a LLM like ChatGPT

Project description

ChatGPContextMaker

ChatGPContextMaker is a command-line utility that concatenates files in a directory and its subdirectories into a single file. It is particularly useful when you want to provide an entire program as context to an AI like ChatGPT to work on code projects.

Features

  • Recursively concatenate files from a directory and its subdirectories
  • Provide a default output location (current working directory) and default output file name
  • Prevent overwriting existing files by appending the current datetime to the output file name
  • Easily installable and usable via pip and Poetry

Installation

Using pip

You can install ChatGPTContextMaker directly from PyPI using pip:

pip install gpcontext-maker

Using Poetry

Alternatively, you can install ChatGPTContextMaker using Poetry:

  1. Install Poetry, if you haven't already:
pip install poetry
  1. Add ChatGPTContextMaker to your project's dependencies:
poetry add gpcontext-maker

Usage

As a command-line tool

To use ChatGPContextMaker as a command-line tool, you can run the following command in your terminal:

python -m gpcontext-maker /path/to/input/directory -o /path/to/output/directory -f output_file_name
  • /path/to/input/directory: The directory containing the files you want to concatenate

  • /path/to/output/directory: The directory where the concatenated file will be saved (default: current working directory)

  • output_file_name: The name of the output file (default: context)

If a file with the same name already exists in the output directory, the current datetime will be appended to the output file name to prevent overwriting.

As a module

You can also use ChatGPTContextMaker as a module in your Python script:

from chatgpcontextmaker import concat_files_recursive

source_directory = "/path/to/input/directory"
output_directory = "/path/to/output/directory"
output_file_name = "output_file_name"

output_file_path = os.path.join(output_directory, output_file_name)

concat_files_recursive(source_directory, output_file_path)

Replace /path/to/input/directory, /path/to/output/directory, and output_file_name with the appropriate paths and file name for your use case. The concat_files_recursive function will concatenate the files from the input directory and its subdirectories and save the result in the specified output file.

Extending ChatGPTContextMaker

You can extend the functionality of ChatGPTContextMaker by modifying the __main__.py script in the chatgpcontextmaker package.

To contribute to the project, simply fork the GitHub repository, make your changes, and submit a pull request.

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

gpcontext_maker-1.5.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

gpcontext_maker-1.5.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file gpcontext_maker-1.5.0.tar.gz.

File metadata

  • Download URL: gpcontext_maker-1.5.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for gpcontext_maker-1.5.0.tar.gz
Algorithm Hash digest
SHA256 8aad9d15744309c46cb3b4913b85bbd2b3c906dd8785a0657dc42cc341aafa55
MD5 0ef5cdc2d4ee10baf6dfebf73d05bd87
BLAKE2b-256 3e90443dd4a79a5b0f9a3e9c4cbe48eded0dfe0575147827eb35e97cf0c8bc69

See more details on using hashes here.

File details

Details for the file gpcontext_maker-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: gpcontext_maker-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.9.13 Darwin/21.6.0

File hashes

Hashes for gpcontext_maker-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c47e888eb4c2a122bd324d50bb164ee0263b032961e363fbf628840df68a96f0
MD5 8dc7248c8990e11cf53fd15fb7ffae1f
BLAKE2b-256 e94738a2b222f1c2f2834343388732768399850aa1d4dc8ee15aed856350fe64

See more details on using hashes here.

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