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
  • --remove-source - Remove source file after successful split

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

# Remove chunks after merge
antporter merge large_file.tar.gz.meta.json --cleanup

# Remove source file after split
antporter split large_file.tar.gz --chunk-size 100MB --remove-source

🐍 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",
    remove_source=False  # Set to True to remove source file after split
)
metadata_path = splitter.split()

# Merge file
merger = FileMerger(
    metadata_file=metadata_path,
    verify=True,
    cleanup=False  # Set to True to remove chunks after merge
)
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.2.tar.gz (15.5 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.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: antporter-1.0.2.tar.gz
  • Upload date:
  • Size: 15.5 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.2.tar.gz
Algorithm Hash digest
SHA256 5f19d1060283180ffafb7a309dd7f25f16104e1cb0b7ad12a14493100060f173
MD5 eedf43025b261230abba13bcda25c7cd
BLAKE2b-256 85613aca35121ef05e44c2b3d007440b1d60781070a904e26ae6fa784c481204

See more details on using hashes here.

File details

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

File metadata

  • Download URL: antporter-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 90a2665e18c3bcd76d96f2f299970690962ae6aa2bc1fa39f027c3812898e795
MD5 63e2ced2c38308eb68dcb283431cc241
BLAKE2b-256 582fc8331c003ea19738f8ba99708c4e02c2ff81db0b0bad0ce35d7746300879

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