Skip to main content

GHRapt

Rapture your files in to the github cloud ☁️✨

files being raptured to the github servers

Because your files deserve a one-way trip to Microsoft's finest servers

GitHub stars PyPI version Test Publish

📦 Installation

pip install ghrapt

☕ Support

If you find this project helpful, consider supporting me:

ko-fi

🚀 Quick Start

# Set your GitHub token
export GH_TOKEN=your_github_token

# Push files to a repository
ghrapt --repo username/repo-name ./path/to/files

# Or with a commit message
ghrapt --repo username/repo-name --message "My backup" ./docs

🎯 Why GHRapt?

  • One-way backup to the cloud - perfect for backups
  • No Git commands needed - just push your files
  • No .git folder - keeps your working directory clean
  • Minimal disk writes - no local Git database to maintain
  • Directory overlay support - merge multiple directories

⚠️ Limitations

  • GitHub API rate limits apply
  • Optimized for small files
  • Not a replacement for full Git version control

Features

  • 📁 Tree-based file management - Work with files and directories as a hierarchical tree structure
  • ☁️ GitHub as storage backend - Store files using GitHub's Git Data API
  • 🔄 Push & Pull - Upload local files to GitHub or download existing trees
  • 📝 Commit support - Create commits with custom messages and parent references
  • 🚫 Gitignore integration - Respect .gitignore patterns during upload
  • 🔗 Symbolic link handling - Configurable strategies for symlinks (keep/follow/safe)
  • 📊 File filtering - Filter by size, ignore patterns, and more

Installation

pip install ghrapt

Configuration

GHRapt requires GitHub authentication. Set the following environment variables:

export GH_REPO="owner/repository-name"
export GH_TOKEN="your_github_token"
export GH_USER="your_username"        # optional
export GH_EMAIL="your_email@example.com"  # optional

Or use a config file at ~/.config/ghrapt.conf or ~/ghrapt.conf:

[owner/repo]
token = your_github_token
email = your_email@example.com

Usage

Command Line Interface

# Upload files to GitHub
ghrapt --repo owner/repo --act /path/to/files

# Upload with commit message
ghrapt -R owner/repo -a -m "Initial commit" ./docs

# Dry run (default)
ghrapt -R owner/repo ./src

# Upload with size filter
ghrapt -R owner/repo --maxsize 1048576 ./files

# Control symlink behavior
ghrapt -R owner/repo --links safe --dir-links follow ./data

Python API

from ghrapt import GHRapt

# Initialize client
api = GHRapt()
api.set_repo("owner/repo")
api.use_logging()

# Place local files into the tree
api.place("./myfiles", root="project")

# Push to GitHub
api.push(dry_run=False)

# Commit changes
api.commit(message="Added my files", dry_run=False)

# Pull existing content
api.pull(ref="master")
api.ls()  # List contents

File Operations

# Remove files
api.rm("file.txt", "old_dir/")

# Rename/move
api.ren("old_name.txt", "new_name.txt")

# List tree contents
api.ls()

# Place files at specific root
api.place("./assets", root="static/images")

How It Works

GHRapt builds an in-memory tree structure representing your files, then pushes them to GitHub using the Git Data API:

  1. Walk - Scan local directories and build a GHNode tree
  2. Push - Upload blobs, trees, and symlinks to GitHub
  3. Commit - Create a commit referencing the root tree SHA
  4. Update ref - Update the branch reference to point to the new commit

Tree Structure

  • GHNode - Tree node containing name and data
  • GHDirData - Directory node with children
  • BlobData - File content (supports streaming for large files)
  • SymlData - Symbolic link
  • GHObject - Remote GitHub object for pulling

Commands Reference

Command Description
pull(ref) Download tree from GitHub
push() Upload local tree to GitHub
place(paths) Add local files to tree
commit(message) Create commit from current tree
ls() List tree contents
rm(paths) Remove files from tree
ren(old, new) Rename/move files

Advanced Options

Push Options

  • stream=True - Stream large files instead of loading into memory
  • pause_sec=N - Add delay between uploads (rate limiting)
  • dry_run=False - Actually push (default is dry run)

Place Options

  • follow_links="keep/follow/safe" - How to handle file symlinks
  • follow_dir_links="keep/follow/safe" - How to handle directory symlinks
  • gitignore_ancestors=True - Respect parent .gitignore files
  • maxsize=N - Skip files larger than N bytes
  • overwrite=True - Overwrite existing files

Commit Options

  • parent_commit_sha - Specify parent commit
  • ref_path - Branch reference (e.g., refs/heads/main)
  • create_ref - Create new branch if it doesn't exist

Status

Alpha - Under active development. APIs may change.

Dependencies

  • requests - HTTP client for GitHub API
  • PyYAML - YAML output formatting

Release files for ghrapt 0.0.2

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

Source distribution (sdist)

Source distribution for ghrapt 0.0.2
File Size Uploaded
ghrapt-0.0.2.tar.gz 62.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ghrapt 0.0.2
File Interpreter ABI Platform
ghrapt-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 115.3 kB

Release files / ghrapt-0.0.2.tar.gz

Download URL ghrapt-0.0.2.tar.gz
Size 62.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5cc7183762a24abcd0882dcd04d9a166620596a74c8320ff863564e092675f4d
BLAKE2b-256 checksum
How to use checksums
0728ba76a588a9bb566a8489c875851d95fba3f06fa95fead57cee7478e2b8b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / ghrapt-0.0.2-py3-none-any.whl

Download URL ghrapt-0.0.2-py3-none-any.whl
Size 52.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce318649b5b8037028fcf73c5888d69fcb0948f7fbba15f19891fb3534f95ee
BLAKE2b-256 checksum
How to use checksums
6c0c4298cd3c17b0b2b529b76d7cfa352d1a6923dae9054e5368942a683045c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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