Skip to main content

Bundle diverse file types into a single, LLM-optimized PDF archive.

Project description

ZiPDF

Bundle diverse file types into a single, LLM-optimised PDF archive.

Quick Start

pip install -e .
# Bundle a folder into a PDF
zipdf ./my_project -o context.pdf
# Or use it in Python
from zipdf import ZiPDF
ZiPDF("context.pdf").add("./my_project").build()

That's it. Upload context.pdf to any LLM.


Why?

LLMs work best with a single, consolidated context. But real projects are spread across dozens of files — source code, configs, docs, data. Most chat interfaces only accept PDFs or have strict file-count limits.

ZiPDF solves this by zipping your project into one clean PDF that any LLM can parse: structured headers, a table of contents, and raw file content in a consistent format.

Install

From PyPI

pip install zipdf

From source

git clone https://github.com/josh-api/zipdf.git
cd zipdf

Create and activate a virtual environment:

# macOS / Linux
python -m venv .venv
source .venv/bin/activate

# Windows (CMD)
python -m venv .venv
.venv\Scripts\activate.bat

# Windows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1

Then install:

pip install -e .

Use pip install -e ".[dev]" to also install development dependencies (pytest).

Usage

CLI

# Bundle an entire directory
zipdf ./my_project -o context.pdf

# Bundle specific files
zipdf main.py utils.py config.yaml -o context.pdf

# Custom exclusions (replaces defaults)
zipdf ./src --exclude "*.log" "tmp/" "*.pyc"

Library

from zipdf import ZiPDF

# Fluent API
ZiPDF("context.pdf").add("src/").add("README.md").build()

# Or step by step
archive = ZiPDF(output="out.pdf", exclude={"*.log", "node_modules"})
archive.add("app/")
archive.add("requirements.txt")
archive.build()

Extending with custom file handlers

from zipdf import register

@register(".csv")
def read_csv_pretty(path: str) -> str:
    """Custom handler that formats CSV nicely."""
    import csv
    with open(path) as f:
        reader = csv.reader(f)
        return "\n".join(",  ".join(row) for row in reader)

PDF Structure

Every generated PDF follows this layout:

  1. System Prompt — Tells the LLM this is a multi-file archive.
  2. Table of Contents — Lists every file with its page number.
  3. File Sections — Each file on a new page:
    --- FILE: src/app.py ---
    [raw file content]
    --- END OF FILE ---
    

Default Exclusions

These patterns are excluded when scanning directories:

.git, __pycache__, .DS_Store, node_modules, .env, .venv, venv, *.pyc, *.pyo, *.egg-info, dist, build

Override with --exclude (CLI) or exclude= (library).

License

MIT

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

zipdf-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

zipdf-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file zipdf-0.1.0.tar.gz.

File metadata

  • Download URL: zipdf-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for zipdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4d3d57dc196f78dd5703c5ee5e8468c333f0165482f663ec5ab34d389e4fd95
MD5 be6b88ccfd538b88d825f39ded32a0bd
BLAKE2b-256 46cc03050197cd1b8f74aad6aba7f2533a3ec5e47c365e74b167021c3e00a218

See more details on using hashes here.

File details

Details for the file zipdf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zipdf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for zipdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15d4b793af8d843ac9316bd02f83d66f40f7e615d8c83b87c729632b511af790
MD5 140d8c625e5c84f1f12a76242d5efa89
BLAKE2b-256 669a84827b662bb7c61f3ee37e4aef80f16b1ca49ae8b11744912a0c4d35dcd7

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