Skip to main content

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.

Metadata

Release files for gpcontext-maker 1.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 gpcontext-maker 1.5.0
File Size Uploaded
gpcontext_maker-1.5.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpcontext-maker 1.5.0
File Interpreter ABI Platform
gpcontext_maker-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / gpcontext_maker-1.5.0.tar.gz

Download URL gpcontext_maker-1.5.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8aad9d15744309c46cb3b4913b85bbd2b3c906dd8785a0657dc42cc341aafa55
BLAKE2b-256 checksum
How to use checksums
3e90443dd4a79a5b0f9a3e9c4cbe48eded0dfe0575147827eb35e97cf0c8bc69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.13 Darwin/21.6.0

Release files / gpcontext_maker-1.5.0-py3-none-any.whl

Download URL gpcontext_maker-1.5.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c47e888eb4c2a122bd324d50bb164ee0263b032961e363fbf628840df68a96f0
BLAKE2b-256 checksum
How to use checksums
e94738a2b222f1c2f2834343388732768399850aa1d4dc8ee15aed856350fe64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.13 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.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