Skip to main content

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 .gitignore files.
  • 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

molddir-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

molddir-0.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file molddir-0.1.1.tar.gz.

File metadata

  • Download URL: molddir-0.1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.19 Linux/6.5.0-1025-azure

File hashes

Hashes for molddir-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f6fddbe0aea20ba0344b0fef1c76b7f9a4d877b5dc96668a6de8501d7aea5fe4
MD5 e213ff58c94306a82b860040928f61d5
BLAKE2b-256 2d56dc35f7bed3a10c0d650dd474e2bc489029f951116da97553815605737ba4

See more details on using hashes here.

File details

Details for the file molddir-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: molddir-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.19 Linux/6.5.0-1025-azure

File hashes

Hashes for molddir-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c330cb178112e66062cbf8a919b61df44eb54763abd59053babbe0045b256e3
MD5 1a5cacb557d901be50790b153c573b39
BLAKE2b-256 dc6ec05723506b5557ba81c130fdf4c32731c15c1407a7b035b757cd84658216

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page