treefeeder
About
treefeeder is a command-line interface (CLI) tool designed to transform a folder of files, such as code files, into a structured string. This string includes both the folder structure (in a Unix tree structure format) and the contents of the files. It's an ideal tool for feeding data into ChatGPT or other large language model (LLM) AI assistants for fine-tuning or query answering.
Installation
To install treefeeder, simply run:
pip install treefeeder
Usage
CLI
You can use treefeeder from the command line by passing the directory path along with optional arguments for customization:
treefeeder <directory_path> [-I ignore_patterns] [-P match_patterns] [-S separator_token]
- <directory_path>: The path to the directory you want to process.
- -I ignore_patterns: Patterns to ignore files or directories.
- -P match_patterns: Patterns to match specific files.
- -S separator_token: The separator token used in output (default is [SEP]).
Python API
treefeeder can also be used within Python. To get a string output of your folder structure and file contents, use:
from treefeeder import get_output
output = get_output(directory_path, ignore_patterns=None, match_patterns=None, separator_token='[SEP]')
Example
treefeeder /path/to/my_project -I *.log -P *.py -S "[SEP]"
This command will process the 'my_project' directory, ignore .log files, match .py files, and use [SEP] as the separator token.
Contributing
Contributions are welcome! Please feel free to submit pull requests, suggest features, or report bugs.
License
treefeeder is open-source and available under MIT License.
Release files for treefeeder 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| treefeeder-0.0.7.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| treefeeder-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / treefeeder-0.0.7.tar.gz
| Download URL | treefeeder-0.0.7.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0c2e91b5202962d51ed29b7d68f5f944541fad0b7f4952ae538b1637d154084
|
|
BLAKE2b-256 checksum How to use checksums |
98f11c56ca8edfe8ee06cbec7e4cb85d39ab2d22f6ae3794615b0bb7c8453ac9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|
Release files / treefeeder-0.0.7-py3-none-any.whl
| Download URL | treefeeder-0.0.7-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a595b213eff34cb569fc110c193ab1b1f37407500bb82f87edc6ce3594f7d42c
|
|
BLAKE2b-256 checksum How to use checksums |
ba902c7faad6b297b97c2c7928d946bae68f842280e421fde4701a179806342c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.18
|