Rapture your files to GitHub cloud
Project description
GHRapt
Rapture your files in to the github cloud ☁️✨
Because your files deserve a one-way trip to Microsoft's finest servers
📦 Installation
pip install ghrapt
☕ Support
If you find this project helpful, consider supporting me:
🚀 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
.gitfolder - 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
.gitignorepatterns 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:
- Walk - Scan local directories and build a
GHNodetree - Push - Upload blobs, trees, and symlinks to GitHub
- Commit - Create a commit referencing the root tree SHA
- Update ref - Update the branch reference to point to the new commit
Tree Structure
GHNode- Tree node containing name and dataGHDirData- Directory node with childrenBlobData- File content (supports streaming for large files)SymlData- Symbolic linkGHObject- 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 memorypause_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 symlinksfollow_dir_links="keep/follow/safe"- How to handle directory symlinksgitignore_ancestors=True- Respect parent.gitignorefilesmaxsize=N- Skip files larger than N bytesoverwrite=True- Overwrite existing files
Commit Options
parent_commit_sha- Specify parent commitref_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 APIPyYAML- YAML output formatting
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ghrapt-0.0.2.tar.gz.
File metadata
- Download URL: ghrapt-0.0.2.tar.gz
- Upload date:
- Size: 62.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cc7183762a24abcd0882dcd04d9a166620596a74c8320ff863564e092675f4d
|
|
| MD5 |
458ab0074570a385b2c370c88ac5dd25
|
|
| BLAKE2b-256 |
0728ba76a588a9bb566a8489c875851d95fba3f06fa95fead57cee7478e2b8b0
|
File details
Details for the file ghrapt-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ghrapt-0.0.2-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ce318649b5b8037028fcf73c5888d69fcb0948f7fbba15f19891fb3534f95ee
|
|
| MD5 |
1a4d43e47ef6b9eb4da2a12094004b15
|
|
| BLAKE2b-256 |
6c0c4298cd3c17b0b2b529b76d7cfa352d1a6923dae9054e5368942a683045c0
|