fmlpack: A tool to convert file trees to/from TEXT, ideal for working with LLM and a lot of files (using Filesystem Markup Language -FML-).
Project description
FMLPack
fmlpack is a tool to convert a file tree to/from a Filesystem Markup Language (FML) document. It creates a single text-based archive of a directory structure, suitable for passing file contexts to LLMs (Large Language Models).
Features
- Pack: Archives files and directories into a single FML file.
- Unpack: Extracts files from an FML archive to the filesystem.
- Filtering: Supports
.gitignorerules via--gitignore, plus specific exclusions via.fmlpackignoreand--exclude. - Safety: Prevents path traversal attacks during extraction.
Installation
Using Pip (Recommended)
Install directly with pip to automatically handle dependencies:
pip install fmlpack
Manual Installation
fmlpack is a single-file Python script, but it requires the pathspec library.
- Install the dependency:
pip install pathspec. - Copy
src/fmlpack.pyto a location in your PATH. - Make it executable:
chmod +x fmlpack.py.
Usage
Creating an archive
# Archive current directory to archive.fml
fmlpack -c . -f archive.fml
# Archive using .gitignore rules (excludes .git/ automatically)
fmlpack -c . --gitignore -f archive.fml
# Archive specific files and folders
fmlpack -c src/ tests/ -f source_code.fml
# Exclude specific patterns
fmlpack -c . --exclude "*.pyc" --exclude "__pycache__"
Extracting an archive
# Extract to current directory
fmlpack -x -f archive.fml
# Extract to specific directory
fmlpack -x -f archive.fml -C /tmp/output
Listing contents
fmlpack -t -f archive.fml
Testing
This project uses pytest for testing.
-
Install test dependencies:
pip install pytest pytest-cov pathspec
-
Run tests:
pytest
-
Run tests with coverage report:
pytest --cov=./src/ tests/test_fmlpack.py
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 fmlpack-0.5.0.tar.gz.
File metadata
- Download URL: fmlpack-0.5.0.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e36f9d37903ed4041e1248fa5a11d9ec0f391a3ea14a921dfb27473f1adb74cf
|
|
| MD5 |
576a35d91e9d2f7871e012f98a4cd6f8
|
|
| BLAKE2b-256 |
85ea8603bb2bb9e7f24f18f4a5a339579ba157221d9231baa821eed186943354
|
File details
Details for the file fmlpack-0.5.0-py3-none-any.whl.
File metadata
- Download URL: fmlpack-0.5.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4459b2b64f2fbf5b48a1c60f10a1c7547b8705d3b7465a852ddba629474306fe
|
|
| MD5 |
52d0f31fed6481549ffdc52fd1dcf2bb
|
|
| BLAKE2b-256 |
b1a89e8dc81a7be1af8b222d82cdf801275751c304ca5ca95846b74fea6ebf9d
|