Skip to main content

Concatenate a directory full of files into a single prompt for use with LLMs

Project description

files-to-prompt

PyPI Changelog Tests License

Concatenate a directory full of files into a single prompt for use with LLMs

Installation

Install this tool using pip:

pip install files-to-prompt

Usage

To use files-to-prompt, provide the path to the directory you want to process:

files-to-prompt path/to/directory

This will output the contents of every file in the directory and its subdirectories, with each file preceded by its relative path and separated by ---.

Options

  • --include-hidden: Include files and folders starting with . (hidden files and directories).

    files-to-prompt path/to/directory --include-hidden
    
  • --ignore-gitignore: Ignore .gitignore files and include all files.

    files-to-prompt path/to/directory --ignore-gitignore
    

Example

Suppose you have a directory structure like this:

my_directory/
├── file1.txt
├── file2.txt
├── .hidden_file.txt
└── subdirectory/
    └── file3.txt

Running files-to-prompt my_directory will output:

my_directory/file1.txt
---
Contents of file1.txt
---
my_directory/file2.txt
---
Contents of file2.txt
---
my_directory/subdirectory/file3.txt
---
Contents of file3.txt
---

If you run files-to-prompt my_directory --include-hidden, the output will also include .hidden_file.txt:

my_directory/.hidden_file.txt
---
Contents of .hidden_file.txt
---
...

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd files-to-prompt
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

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

files-to-prompt-0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

files_to_prompt-0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file files-to-prompt-0.1.tar.gz.

File metadata

  • Download URL: files-to-prompt-0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for files-to-prompt-0.1.tar.gz
Algorithm Hash digest
SHA256 fe5748d20d53e392c032003c4119c8cd412b7c33e873c9c32f287c62b6f8a402
MD5 0571c4d7ae4d0946b1788599cc498cc1
BLAKE2b-256 1b6b3c9cc5ba55d365244562a4b57e888ad173cbe0fa41b7838c4b537cb1eccc

See more details on using hashes here.

File details

Details for the file files_to_prompt-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for files_to_prompt-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4774ea3b497fa799926989cc440da0045591aff7953b7ead7dd38a5c9575e858
MD5 302f58d07be7ebc65ef81fc4bc3d02d2
BLAKE2b-256 b3710d47723be846449fbc94dfbd79409de52634ad70f70ea4033b9ae4867bd7

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