Skip to main content

repo-context

uv Ruff Quality Check Unit Tests code coverage Publish

Convert Git repositories into LLM-friendly context format. This tool processes local repositories or GitHub URLs and generates a formatted file suitable for use with Large Language Models.

Features

  • Process local Git repositories or GitHub URLs
  • Configurable file ignore patterns
  • Progress tracking with rich console output
  • Markdown-formatted output optimized for LLM context
  • Built with UV package manager support

Installation

Using UV:

uv venv
uv pip install repo-context

From source:

git clone https://github.com/mathiasesn/repo-context
cd repo-context
uv venv
uv pip install -e .

Usage

Command Line Interface

Basic usage:

repo-context /path/to/local/repo
repo-context https://github.com/username/repo

Options:

repo-context --help
usage: repo-context [-h] [--output OUTPUT] [--ignore IGNORE [IGNORE ...]] source

Convert a repository into LLM-friendly context

positional arguments:
  source                Local path or GitHub URL to repository

options:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        Output file path (default: context.md)
  --ignore IGNORE [IGNORE ...]
                        Patterns to ignore (default: ['.git', '__pycache__', '*.pyc', '*.pyo', '*.pyd', '.DS_Store'])

Python API

from repo-context import RepoConverter

converter = RepoConverter(ignore_patterns=[".git", "*.pyc"])
context = converter.convert("/path/to/repo")

Output Format

The tool generates a Markdown file with the following structure:

# File: path/to/file1

``` 
[file1 content]
``` 

# File: path/to/file2
``` 
[file2 content]
``` 

Development

Requirements:

  • Python >=3.12
  • UV package manager

Setup development environment:

uv venv
uv pip install -e ".[dev]"

Run tests:

pytest tests/

License

MIT License

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Metadata

Release files for repo-context 0.4.0

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

Source distribution (sdist)

Source distribution for repo-context 0.4.0
File Size Uploaded Provenance
repo_context-0.4.0.tar.gz 36.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for repo-context 0.4.0
File Interpreter ABI Platform
repo_context-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.8 kB

Release files / repo_context-0.4.0.tar.gz

Download URL repo_context-0.4.0.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
094f5d218cdda2d77e89149d1854b965a77c5d0032a926cb5ad357eff1c3f094
BLAKE2b-256 checksum
How to use checksums
976a074e14e36e1abd49ce55f8824068dfeb20b450dd753d16312f92d0a22412
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 26, 2025.

Transparency log

Release files / repo_context-0.4.0-py3-none-any.whl

Download URL repo_context-0.4.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
442790f3d725eceb5937031f8f21b2d981009169b37070c717fca6ee56796925
BLAKE2b-256 checksum
How to use checksums
391b45ea497116f14295fa6e480443fd41a1a52d9dd7ff418993b9bf959cfdcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 26, 2025.

Transparency log

Security for repo-context 0.4.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for repo_context-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 26, 2025.

Transparency log

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.

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