Skip to main content

A tool to convert a repository into flattened files for easier LLM upload

Project description

Repo Flattener

A Python package to convert a repository into flattened files for easier uploading to Large Language Models (LLMs).

Features

  • Flattens repository structure by creating single files with path information
  • Creates a manifest file showing the original structure
  • Configurable ignore lists for directories and file extensions
  • Simple command-line interface

Installation

From PyPI

pip install repo-flattener

From Source

git clone https://github.com/CruiseDevice/repo-flattener.git
cd repo-flattener
pip install -e .

Usage

Command Line

# Basic usage
repo-flattener /path/to/repository

# Specify output directory
repo-flattener /path/to/repository --output flattened_files

# Add custom directories to ignore
repo-flattener /path/to/repository --ignore-dirs build,dist

# Add custom file extensions to ignore
repo-flattener /path/to/repository --ignore-exts .log,.tmp

Python API

from repo_flattener import process_repository

# Basic usage
process_repository('/path/to/repository', 'flattened_files')

# With custom ignore lists
process_repository(
    '/path/to/repository',
    'flattened_files',
    ignore_dirs=['build', 'dist'],
    ignore_exts=['.log', '.tmp']
)

Output

The tool creates a directory with:

  1. Flattened files named according to their original path (with path separators replaced by underscores)
  2. A file_manifest.txt showing the original repository structure

Development

Running Tests

pytest

License

MIT License

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

repo_flattener-0.1.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

repo_flattener-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file repo_flattener-0.1.1.tar.gz.

File metadata

  • Download URL: repo_flattener-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for repo_flattener-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8fb88aadb1e13b00d7843ffdd988928b728073e380c284f6214070bece3d137f
MD5 9f3b525fbde95a448aa464962423b0e1
BLAKE2b-256 ab681f22a43b460d93e0d2615a9f3548a3ee14fd269ea4ec1dc77a378152af1e

See more details on using hashes here.

File details

Details for the file repo_flattener-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: repo_flattener-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for repo_flattener-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6002ba9e1408d6acf8c8a02a3277b9d52f359e111d0a94fc0701c56538bf49c5
MD5 7c91a769aa9b327261c645f5ad490c67
BLAKE2b-256 7ef43aa48542f6d4d300bf4030d333f018bb02511743477ffd18d45c5b516edd

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