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

Library

from glume import Glume

packer = Glume(
    target_dir="./my-project",
    ignore_patterns=["*.pyc", "__pycache__"],
    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 or None Custom Jinja2 template string for rendering the output Built-in template
ignore_patterns list[str] or None Glob patterns for files and directories to ignore 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.1 - 2026-11-10

Added

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

Metadata

Release files for glume 0.1

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.1
File Size Uploaded Provenance Actions
glume-0.1.tar.gz 17.3 kB Without provenance Details for glume-0.1.tar.gz

Built distribution (wheel)

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

Total release size: 29.7 kB

Release files / glume-0.1.tar.gz

Download URL glume-0.1.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1f6364dc617dfa910ef384f268ed7206f6fa4645f4fbff6a86f4f4f5cdb836e5
BLAKE2b-256 checksum
How to use checksums
44f4e59e6cc14f3c4f35c647cba0082a5fec7793fedde19b0e3f3c2ac8958117
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.1-py3-none-any.whl

Download URL glume-0.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30a47cd70850654956d4b4adf629e33c5e11046b85c136cac1efc9f0b84a1c23
BLAKE2b-256 checksum
How to use checksums
0e08529bc64cf93c03318ef185c7cb83284f292c9c04d1b798eaa2a37f58e1fb
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.1

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.1 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