Bundle a repository into a single XML file for LLMs.
Project description
repo2xml
Bundle a complete repository into a single XML file that ChatGPT or other LLMs can read, inspired by repomix.
Features
- Walks any directory tree and bundles readable files into XML
- Respects
.gitignorerules (via pathspec) - Uses layered file detection: Magika, then
puremagicMIME, thenidentify - Converts supported non-text files to Markdown via
markitdown - Skips zero-byte files, oversized files, and common build/cache directories automatically
- Outputs a well-formed XML document with a directory tree and full file contents
- CLI tool (
repo2xml) and importable Python API
Installation
pip install repo2xml
Or with uv:
uv tool install repo2xml
Usage
CLI
# Bundle current directory to stdout
repo2xml --repo-path .
# Bundle a specific directory and save to a file
repo2xml --repo-path /path/to/repo -o repo.xml
# Skip .gitignore and add extra exclusions
repo2xml --repo-path /path/to/repo --no-gitignore --ignore "*.log" --ignore "tests/"
Python API
from repo2xml import bundle_repo, RepoBundler
# Simple one-liner
xml = bundle_repo("/path/to/repo")
# More control
bundler = RepoBundler(
"/path/to/repo",
respect_gitignore=True,
max_file_size=500_000,
extra_ignore_patterns=["*.csv", "data/"],
)
xml = bundler.bundle()
Output Format
<?xml version="1.0" encoding="UTF-8"?>
<repository>
<file_summary>
<purpose>...</purpose>
<usage_guidelines>...</usage_guidelines>
</file_summary>
<repository_info>
<name>my-repo</name>
<path>/home/user/my-repo</path>
<file_count>42</file_count>
</repository_info>
<directory_structure>
my-repo/
├── README.md
└── src/
└── main.py
</directory_structure>
<files>
<file path="README.md">
<content>...</content>
</file>
</files>
</repository>
Development
Requires uv.
# Install dependencies
uv sync --extra dev
# Run tests
uv run pytest --doctest-modules
just test-cov
# Lint and format
uvx ruff check src
uvx ruff format src
# Build one-file executable via PyInstaller
just build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
repo2xml-2026.4.12.2.tar.gz
(10.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repo2xml-2026.4.12.2.tar.gz.
File metadata
- Download URL: repo2xml-2026.4.12.2.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01abc4e7d936ec770939ce44a85610cc667ad8a6b8a25e819d4d5b555a37412b
|
|
| MD5 |
e3cd859f18810c341407768fbcfd87d1
|
|
| BLAKE2b-256 |
b3ca9c1f3ca760f57178293c61840420e98441feaba86776aea83812a3525687
|
File details
Details for the file repo2xml-2026.4.12.2-py3-none-any.whl.
File metadata
- Download URL: repo2xml-2026.4.12.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a9cbcf18c4d4cf338a4d77fa8c6dc3e5676e95db82339d72a99dd2271e5d696
|
|
| MD5 |
4ebb435cf730fc8b943176b26134f33c
|
|
| BLAKE2b-256 |
68d099d95e5c31ea52282b0eb5d217c7b0a924c21507be95e4c21b5266629552
|