molddir simplifies merging directory files into a single file. It's especially useful for sending entire codebases to Large Language Models (LLMs) by encoding the codebase into one string
Project description
molddir: Encoder-Decoder Module
molddir is a Python package that provides a simple way to encode and decode files and directories into a custom format. This module is particularly useful in the era of Large Language Models (LLMs), where sending a complete codebase to an LLM can be a tedious task. molddir helps by encoding the entire codebase into a single string, which can then be easily decoded back into the original files and directories.
Features
- Encoder Class: Encodes files and directories into a custom format.
- Decoder Class: Decodes the encoded data back into files and directories.
- CLI Tool: Provides a command-line interface for easy usage.
- Supports ignoring files from repository
.gitignorefiles. - Allows you to customize the encoding pattern using keys.py module.
Installation
You can install molddir using Poetry:
poetry add molddir
Or using pip:
pip install molddir
Usage
Using the Module
Encoder Class
The Encoder class is responsible for encoding files and directories into a custom format. It takes in a codebase path as an argument, which can be a file or a directory.
from molddir import Encoder
encoder = Encoder("path/to/codebase")
encoded_data = encoder()
print(encoded_data)
Decoder Class
The Decoder class is responsible for decoding the encoded data back into files and directories.
from molddir import Decoder
decoder = Decoder("output_dir")
decoder(encoded_str="@@@@@@@file1@@@@@@@\nprint('Hello, World!')\n=======\n")
Using the CLI Tool
molddir also provides a command-line interface for easy usage.
Encoding
To encode a codebase, run:
molddir --encode --codebase_path path/to/codebase
Decoding
To decode the encoded data back into files and directories, run:
molddir --decode --encoded_file encoded_data.txt --output_dir output_dir
Why Use molddir?
In the era of Large Language Models (LLMs), sending a complete codebase to an LLM can be a tedious task. molddir simplifies this process by encoding the entire codebase into a single string. This encoded string can then be easily sent to an LLM, and decoded back into the original files and directories when needed.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file molddir-0.1.0.tar.gz.
File metadata
- Download URL: molddir-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a87868b4ebc896360fea5bdba0be78cb878e972d197334978aad4db2b31846
|
|
| MD5 |
d93cf72097dc1a5130d8a550a8a2fb4c
|
|
| BLAKE2b-256 |
619d18c1675b0f053924392820f224aecbfff300a876fe2e2ff8bc5bc1b67baa
|
File details
Details for the file molddir-0.1.0-py3-none-any.whl.
File metadata
- Download URL: molddir-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aae36d866d426a50821c0875fa6b6220e23ae601c98b56b0dd4b9ec90870bdd0
|
|
| MD5 |
07792e16887dd75f2397a1567a70930a
|
|
| BLAKE2b-256 |
84be680fed07b86277a391dfcea74635fc8408bf94902d8ca75a3d144065d604
|