Skip to main content

A simple tool for splitting and merging files to bypass HPC cluster file upload size limits

Project description

AntPorter

Python Version License

A simple and efficient file splitting and reassembly tool designed to circumvent file upload size limitations on HPC clusters.


✨ Features

  • 🚀 Fast & Efficient - Optimized for large file operations
  • 🔒 Data Integrity - MD5 checksum verification
  • 📊 Progress Tracking - Real-time progress bars
  • 💾 Resume Support - Continue interrupted operations
  • 🛠️ Easy to Use - Simple command-line interface
  • 🐍 Pure Python - Only depends on tqdm, cross-platform

📦 Installation

pip install antporter

Or using uv:

uv pip install antporter

🚀 Quick Start

1. Split a File

antporter split large_file.tar.gz --chunk-size 100MB

This creates:

  • large_file.tar.gz.part001
  • large_file.tar.gz.part002
  • large_file.tar.gz.part003
  • ...
  • large_file.tar.gz.meta.json

2. Upload to HPC

scp large_file.tar.gz.* username@hpc-cluster:/path/to/destination/

3. Merge on HPC

antporter merge large_file.tar.gz.meta.json

📖 Usage

Split Command

antporter split <file> --chunk-size <size> [options]

Options:

  • --chunk-size, -s - Chunk size (e.g., 100MB, 1GB, 500KB)
  • --output-dir, -o - Output directory
  • --no-resume - Disable resume functionality

Merge Command

antporter merge <metadata> [options]

Options:

  • --output-dir, -o - Output directory
  • --cleanup, -c - Delete chunks after merge
  • --no-verify - Skip MD5 verification (not recommended)

Info Command

antporter info <metadata> [--chunks]

💡 Examples

Scenario 1: Upload Large Dataset to HPC (100MB limit)

# Local machine
antporter split dataset.tar.gz --chunk-size 95MB --output-dir ./upload

# Upload
cd upload
scp * username@hpc:/scratch/user/

# On HPC
ssh username@hpc
cd /scratch/user/
antporter merge dataset.tar.gz.meta.json

Scenario 2: Resume Interrupted Split

# Start splitting
antporter split large_file.bin --chunk-size 100MB

# ... interrupted ...

# Resume (automatically skips completed chunks)
antporter split large_file.bin --chunk-size 100MB

Scenario 3: Auto Cleanup

antporter merge large_file.tar.gz.meta.json --cleanup

🐍 Python API

from antporter import FileSplitter, FileMerger

# Split file
splitter = FileSplitter.from_size_string(
    input_file="large_file.tar.gz",
    chunk_size_str="100MB",
    output_dir="./chunks"
)
metadata_path = splitter.split()

# Merge file
merger = FileMerger(
    metadata_file=metadata_path,
    verify=True,
    cleanup=False
)
output_path = merger.merge()

📝 Metadata Format

{
  "original_filename": "data.tar.gz",
  "original_size": 1073741824,
  "original_md5": "abc123...",
  "chunk_size": 104857600,
  "chunk_count": 11,
  "chunks": [
    {
      "index": 1,
      "filename": "data.tar.gz.part001",
      "size": 104857600,
      "md5": "def456..."
    }
  ],
  "created_at": "2025-12-29T10:00:00",
  "version": "1.0"
}

🔧 Development

# Clone repository
git clone https://github.com/yourusername/antporter.git
cd antporter

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/antporter

# Lint code
flake8 src/antporter

📄 License

MIT License - see LICENSE file for details

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

antporter-1.0.1.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

antporter-1.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file antporter-1.0.1.tar.gz.

File metadata

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

File hashes

Hashes for antporter-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b41099ac6a6e6a994b2f84dac51be9e446f5ecd5b5e737f2f48891f714458565
MD5 6cd29276448c88f03ec442d1864ef33f
BLAKE2b-256 5b7ce7027abc1af4273e736e566711669d01665aada826459734b324b76bcfc0

See more details on using hashes here.

File details

Details for the file antporter-1.0.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for antporter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 830f78d8317c04d5165244984f5e98125f3d613ee1c307d2a589bb89a9155a05
MD5 09b26bdbeb0849a05d12442b657c659b
BLAKE2b-256 e9aa11c97ada1eecf09e4e11d7ef238cc7ea1afb81926d8f401b9efbd29aab57

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