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
Documentation
Project docs are built with Zensical from docs/index.md using zensical.toml.
If GitHub Pages is enabled for this repository, the published docs URL will be:
https://<owner>.github.io/<repo>/
Deployment is handled by docs workflow.
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/"
# Control progress display explicitly
repo2xml --repo-path /path/to/repo --progress
repo2xml --repo-path /path/to/repo --no-progress
When running in an interactive terminal,
repo2xml auto-enables a progress bar.
Progress is written to stderr, so XML output stays clean
for -o FILE and stdout redirection.
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 and serve docs
just docs-build
just docs-serve
# Build and serve automatic Sphinx API docs
just sphinx-build
just sphinx-serve
# Build one-file executable via PyInstaller
just build
Metadata
Release files for repo2xml 2026.4.13.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| repo2xml-2026.4.13.2.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| repo2xml-2026.4.13.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.6 kB
Release files / repo2xml-2026.4.13.2.tar.gz
| Download URL | repo2xml-2026.4.13.2.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaee9be2d92da942559a6770359e5cfbf246e50f0006f1ac4d96e5ef09b46b7b
|
|
BLAKE2b-256 checksum How to use checksums |
faa23239460107b7d8e602f05762b429f76881744ce96a165ccc4e26fabe16ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / repo2xml-2026.4.13.2-py3-none-any.whl
| Download URL | repo2xml-2026.4.13.2-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7de795b9d578dcc15af1378bd25269a0482855cd06271409d5711ae305da77c
|
|
BLAKE2b-256 checksum How to use checksums |
6a0a1f86b2217672e7a2a67d604c105d3be4bb4ddb5adf44bda9b38a42fffa16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|