Concatenate a directory full of files into a single prompt for use with LLMs
Project description
files-to-prompt
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 one or more files or directories you want to process:
files-to-prompt path/to/file_or_directory [path/to/another/file_or_directory ...]
This will output the contents of every file, 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
-
--ignore <pattern>
: Specify one or more patterns to ignore. Can be used multiple times.files-to-prompt path/to/directory --ignore "*.log" --ignore "temp*"
Example
Suppose you have a directory structure like this:
my_directory/
├── file1.txt
├── file2.txt
├── .hidden_file.txt
├── temp.log
└── 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
---
...
If you run files-to-prompt my_directory --ignore "*.log"
, the output will exclude temp.log
:
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
---
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
Built Distribution
File details
Details for the file files-to-prompt-0.2.1.tar.gz
.
File metadata
- Download URL: files-to-prompt-0.2.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a544a4ecbcf02c1ae562a22b9f9901b755860e651879c36c093fe549a6c503c4 |
|
MD5 | a8e31bffee1b175d9b6447d10b139049 |
|
BLAKE2b-256 | 4a7e3f4c51cd4a6b07afecb0179c86c6f223f1bf03f97af3e5e5351cdf3ee578 |
File details
Details for the file files_to_prompt-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: files_to_prompt-0.2.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84261831591c4a5b7e6401b1e1e6be2dcf4da1af8df518210e28e52bbb26634 |
|
MD5 | fd214aa15f3bc13bba3f7a491e6215b7 |
|
BLAKE2b-256 | ee393d2db6592885a242d232a0c430946cc08a5dce5ab66d529f477f7d2c7902 |