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.0.tar.gz (5.1 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.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repo_flattener-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for repo_flattener-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd73fb6554cc75fc2cb9b7774d633cf2d6434acd8a06a5eaf787c0affac84507
MD5 104379dc026eea0b7cf88dfb5041d993
BLAKE2b-256 1c364b2b298606a25af8f1ac20d2ea60b4edc49045c09693f5f267bfdd11cd86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repo_flattener-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for repo_flattener-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26421e038e1dc13e26126f5b3615aa62f2f639642adfcad9379d023e8c8570ef
MD5 3af9d486ac57b02ada80acfea62ed3ed
BLAKE2b-256 2ecfc0aa0be139ad13636c594a8e90ca9ec0112df8da1b0463fa5d9b53ca3b6b

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