Skip to main content

Glume: A Nano File-to-Text Packer for LLM Context Windows


built with Python3 GitHub repo size PyPI version

Overview

Glume is a lightweight Python tool for packing project files into a structured text representation optimized for LLM context windows. It collects readable files from a target directory and combines their contents into a single formatted output, optionally including the directory structure tree. Glume supports customizable Jinja2 templates, glob-based include and ignore patterns, automatic .gitignore integration, and file processing statistics. It can be used both as a CLI tool and as an importable Python library.

PyPI Counter
Github Stars
Branch main dev
CI
Code Quality CodeFactor

Installation

Source Code

PyPI

Usage

Glume can be used both as a CLI tool and as a Python library.

CLI

python -m glume

Pack a specific directory:

python -m glume ./my-project

Save the packed output to a file:

python -m glume ./my-project -o context.txt

Options

Option Description Default
directory Target directory to pack (positional argument) .
--directory Target directory to pack (optional argument) None
-o, --output Output file path Standard output
-t, --template Path to a custom Jinja2 template file Built-in template
--no-tree Disable directory structure tree inclusion Enabled
-i, --ignore Glob patterns to ignore (can be used multiple times) None
--include Glob patterns to include (can be used multiple times) None
--git-ignore Load and apply rules from the project's .gitignore file Disabled
-v, --verbose Display warnings for unreadable files Disabled
--stats Display detailed file processing statistics Disabled
--version Display Glume version Disabled
--info Display Glume info Disabled

Library

from glume import Glume

packer = Glume(
    target_dir="./my-project",
    ignore_patterns=["*.pyc", "__pycache__"],
    include_patterns=["*.py", "*.md"],
    use_gitignore=True,
    include_tree=True,
    verbose=False
)

result = packer.pack()

with open("context.txt", "w", encoding="utf-8") as f:
    f.write(result)

Parameters

Parameter Type Description Default
target_dir str or Path Root directory containing files to pack "."
custom_template str Custom Jinja2 template string for rendering the output Built-in template
ignore_patterns list[str] Glob patterns for files and directories to ignore None
include_patterns list[str] Glob patterns for files and directories to include None
use_gitignore bool Load ignore patterns from the root directory's .gitignore file False
include_tree bool Include the directory structure tree in the output True
verbose bool Display warnings when files cannot be read False

Statistics

You can retrieve file processing statistics after packing:

stats = packer.get_stats()

print(stats["included_count"])
print(stats["ignored_count"])
print(stats["binary_count"])
print(stats["failed_count"])

Custom Template

Glume supports custom Jinja2 templates for formatting the packed output.

custom_template = """
{% for file in files %}
### {{ file.path }}

{{ file.content }}
{% endfor %}
"""

packer = Glume(
    target_dir="./my-project",
    custom_template=custom_template
)

result = packer.pack()

Issues & Bug Reports

Just fill an issue and describe it. We'll check it ASAP!

  • Please complete the issue template

Show Your Support

Star This Repo

Give a ⭐️ if this project helped you!

Donate to Our Project

Bitcoin

1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy

Ethereum

0xcD4Db18B6664A9662123D4307B074aE968535388

Litecoin

Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ

Doge

DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh

Tron

TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7

Ripple

rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq

Binance Coin

bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef

Tether

0xcD4Db18B6664A9662123D4307B074aE968535388

Dash

Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s

Stellar

GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL

Zilliqa

zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5

Coffeete

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.2 - 2026-11-22

Added

  • --directory CLI argument
  • --version CLI argument
  • --info CLI argument
  • --include CLI argument
  • include_patterns parameter

Changed

  • README.md updated
  • Test system modified
  • Output mirroring bug fixed
  • Wizard mode bug fixed

0.1 - 2026-11-10

Added

  • Glume class
  • GlumeError class
  • GlumeValidationError class
  • Command line interface
  • Test system

Metadata

Release files for glume 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glume 0.2
File Size Uploaded Provenance Actions
glume-0.2.tar.gz 19.3 kB Without provenance Details for glume-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glume 0.2
File Interpreter ABI Platform Actions
glume-0.2-py3-none-any.whl Python 3 none any Details for glume-0.2-py3-none-any.whl

Total release size: 32.9 kB

Release files / glume-0.2.tar.gz

Download URL glume-0.2.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
322b093f9d58c384da355f612f2cb748d19461955f19bc55bd45d1d6c5581a7f
BLAKE2b-256 checksum
How to use checksums
4e1dc84eeb4b9f9440cff9753dd1fde363fee4b74037fbf764c164b7828c029b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / glume-0.2-py3-none-any.whl

Download URL glume-0.2-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ec8d83240a08262308451ebe4edf8f162d327f6d1196da96fff1264f0e74290
BLAKE2b-256 checksum
How to use checksums
9255fdb87f82b2af67859d27b2c4f1565408df0cdaf28bf585890121cd61c883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for glume 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page