Skip to main content

A tool to pack and unpack project files into a single file for easy sharing and LLM interaction.

Project description

OneForAll

PyPI version License: MIT Pack and unpack project source code into a single, structured text file. Ideal for sharing, archiving snapshots, and interacting with Large Language Models (LLMs) like Gemini, Claude, or GPT.

The Problem

Sharing multi-file codebases or providing them as context to LLMs can be cumbersome. You might need to zip archives, copy-paste multiple files, or struggle with context window limits. LLMs often work best when they can see the relevant code structure and content together.

The Solution

oneforall traverses your project directory, reads the text-based source files, and concatenates them into one .oneforall file. Each file's content is clearly marked with its original path. It intelligently ignores files based on default patterns (like .git, __pycache__, .venv) and your project's .gitignore file (or a custom ignore file).

You can then easily share this single file or paste its content into an LLM prompt. oneforall can also unpack this bundle file back into the original directory structure.

Key Features:

  • Packs relevant project files into a single text file (.oneforall).
  • Unpacks a .oneforall file back into a directory structure.
  • Uses .gitignore syntax for excluding files (reads .gitignore by default, supports custom ignore files).
  • Includes sensible default ignores for common temporary files, caches, and VCS directories.
  • Provides clear markers showing the original path of each file within the bundle.
  • Skips likely binary files.
  • Simple Command-Line Interface (CLI).
  • Can also be used programmatically.

Installation

pip install oneforall

Usage

oneforall provides two main commands: bundle and unbundle.

Bundling a Project (bundle)

This command packs a project directory into a single .oneforall file.

Basic Syntax:

oneforall bundle <source_directory> [options]

Arguments:

  • <source_directory>: (Required) The path to the project directory you want to bundle. Use . for the current directory.

Options:

  • -o OUTPUT, --output OUTPUT: Specifies the path for the output .oneforall file.
    • If omitted, the default is <source_directory_name>.oneforall in the current working directory (e.g., bundling my_project/ creates my_project.oneforall).
    • If <source_directory> is ., the default output is <current_directory_name>.oneforall.
  • -i IGNORE, --ignore IGNORE: Path to a custom .gitignore-style file. Patterns in this file are added to the patterns found in the standard .gitignore within the source_directory (if one exists).
  • -h, --help: Show the help message for the bundle command.

Examples:

  1. Bundle the current directory into the default output file:

    oneforall bundle .
    # Creates 'oneforall.oneforall' (if run in the project root)
    
  2. Bundle a specific project directory into a named output file:

    oneforall bundle ./my_cool_project -o cool_project_bundle.ofa
    
  3. Bundle the current directory using an additional custom ignore file:

    oneforall bundle . --ignore ./.custom_ignores
    

Unbundling a Project (unbundle)

This command extracts the contents of a .oneforall file back into a directory structure.

Basic Syntax:

oneforall unbundle <bundle_file> -o <output_directory> [options]

Arguments:

  • <bundle_file>: (Required) The path to the .oneforall file you want to unpack.

Options:

  • -o OUTPUT, --output OUTPUT: (Required) The path to the target directory where the project structure will be created. The directory will be created if it doesn't exist.
  • -h, --help: Show the help message for the unbundle command.

Examples:

  1. Unpack a bundle into a new directory:

    oneforall unbundle cool_project_bundle.ofa -o ./unpacked_project
    # Creates ./unpacked_project/ and extracts the contents there
    
  2. Unpack a bundle into an existing directory (will overwrite existing files with the same name):

    oneforall unbundle project.oneforall -o ./existing_output_dir
    

Programmatic Usage

You can also use oneforall directly within your Python code:

from oneforall import pack, unpack
from pathlib import Path

# Define paths
source_dir = Path("./my_project")
bundle_file = Path("my_project.oneforall")
output_dir = Path("./unpacked_project")

try:
    # Pack the project
    pack(source_dir, bundle_file)
    print(f"Project packed into {bundle_file}")

    # Unpack the project
    unpack(bundle_file, output_dir)
    print(f"Project unpacked into {output_dir}")

except FileNotFoundError as e:
    print(f"Error: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

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

oneforall-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

oneforall-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for oneforall-0.1.0.tar.gz
Algorithm Hash digest
SHA256 704332a6ce5dcb88b555591b6386d7e7cd31bed787d87834ec1f02a58e0f7217
MD5 c15570ad1757619d4bd38c1406df167d
BLAKE2b-256 1747cef2718b6ce153d2d52be4fefdb664728a5aa93a1e5fd5909ff8f0aecc6d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for oneforall-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fdada97b41c0f569ebc43228e63352b25bcfbb9755d46f0e4660974c4fe5781
MD5 1ed913945910fc1a222a2a46058451a8
BLAKE2b-256 40a7b3c1e7c0bfe34ae8c6d849aea6ffb6b18f2e57a95cf92be4b909de6d6c85

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