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.2.2.tar.gz (16.3 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.2.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file fmlpack-0.2.2.tar.gz.

File metadata

  • Download URL: fmlpack-0.2.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for fmlpack-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0db8666e564f942ae0ac82dcad841200a8f2819fdee273607739ce2df8184ab7
MD5 7614c07d5996deb1889ed18633dbf356
BLAKE2b-256 dfdb95d6ff3feacdf120b20fadd41fb2d82573c80306acd4df477f38fcdd0efa

See more details on using hashes here.

File details

Details for the file fmlpack-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: fmlpack-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd6472339df48385c8c7223cb3c39562f5fbd94cad53e522cf5b05606fb6f94
MD5 dacb6ee408849077820b5e4cdf54d4b0
BLAKE2b-256 3844a0d03dbe8280b63d58dc1b6e4d2712c848a2c3707b3beb62e02cd5e31ac1

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