Skip to main content

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

codecov

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 .gitignore rules via --gitignore, plus specific exclusions via .fmlpackignore and --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.

  1. Install the dependency: pip install pathspec.
  2. Copy src/fmlpack.py to a location in your PATH.
  3. 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.

  1. Install test dependencies:

    pip install pytest pytest-cov pathspec
    
  2. Run tests:

    pytest
    
  3. 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

fmlpack-0.5.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

fmlpack-0.5.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

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

Hashes for fmlpack-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e36f9d37903ed4041e1248fa5a11d9ec0f391a3ea14a921dfb27473f1adb74cf
MD5 576a35d91e9d2f7871e012f98a4cd6f8
BLAKE2b-256 85ea8603bb2bb9e7f24f18f4a5a339579ba157221d9231baa821eed186943354

See more details on using hashes here.

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

Hashes for fmlpack-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4459b2b64f2fbf5b48a1c60f10a1c7547b8705d3b7465a852ddba629474306fe
MD5 52d0f31fed6481549ffdc52fd1dcf2bb
BLAKE2b-256 b1a89e8dc81a7be1af8b222d82cdf801275751c304ca5ca95846b74fea6ebf9d

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