or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration.mdfile-listing.mdfile-management.mdfile-transfer.mdhash-operations.mdindex.mdpublic-links.mdremote-management.md
tile.json

tessl/pypi-rclone-python

A python wrapper for rclone that makes rclone's functionality usable in python applications.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/rclone-python@0.1.x

To install, run

npx @tessl/cli install tessl/pypi-rclone-python@0.1.0

index.mddocs/

rclone-python

A comprehensive Python wrapper for the rclone command-line tool that enables programmatic access to cloud storage operations. It provides a rich, Python-native interface for copying, moving, syncing files across 70+ cloud storage providers with progress tracking, authentication management, and comprehensive error handling.

Package Information

  • Package Name: rclone-python
  • Language: Python
  • Installation: pip install rclone-python
  • Prerequisites: rclone must be installed on the system

Core Imports

from rclone_python import rclone

For hash types and remote types:

from rclone_python.hash_types import HashTypes
from rclone_python.remote_types import RemoteTypes

For exceptions:

from rclone_python.utils import RcloneException

Basic Usage

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

# Check if rclone is installed
if rclone.is_installed():
    # Create a new remote for OneDrive
    rclone.create_remote('onedrive', RemoteTypes.onedrive)
    
    # Copy files from OneDrive to local directory
    rclone.copy('onedrive:data', 'local_data', show_progress=True)
    
    # List files in a remote directory
    files = rclone.ls('onedrive:data', max_depth=1, files_only=True)
    
    # Sync local directory to remote
    rclone.sync('local_data', 'onedrive:backup')

Architecture

The rclone-python wrapper is built around several key components:

  • Main rclone module: Core functions for all file operations, remote management, and system interaction
  • Type definitions: Enums for hash algorithms (HashTypes) and cloud providers (RemoteTypes)
  • Progress tracking: Rich-based progress bars with real-time transfer statistics and file-level detail
  • Configuration management: Singleton pattern for custom config file paths and logging levels
  • Error handling: Custom RcloneException with detailed error information

The wrapper maintains compatibility with all rclone command-line options while providing Python-native interfaces, progress callbacks, and structured return values.

Capabilities

File Transfer Operations

Core transfer functionality including copy, move, and sync operations with progress tracking, custom progress bars, and event listeners for real-time transfer monitoring.

def copy(in_path: str, out_path: str, ignore_existing=False, show_progress=True, 
         listener: Callable[[Dict], None] = None, args=None, pbar=None): ...
def move(in_path: str, out_path: str, ignore_existing=False, show_progress=True,
         listener: Callable[[Dict], None] = None, args=None, pbar=None): ...
def sync(src_path: str, dest_path: str, show_progress=True,
         listener: Callable[[Dict], None] = None, args=None, pbar=None): ...

File Transfer Operations

Remote Management

Functions for creating, configuring, and managing cloud storage remotes with OAuth authentication support and comprehensive remote validation.

def create_remote(remote_name: str, remote_type: Union[str, RemoteTypes], 
                  client_id: Union[str, None] = None, client_secret: Union[str, None] = None, **kwargs): ...
def get_remotes() -> List[str]: ...
def check_remote_existing(remote_name: str) -> bool: ...

Remote Management

File Listing and Information

Comprehensive file system operations including directory listing, file metadata, storage quotas, and tree-style directory visualization.

def ls(path: str, max_depth: Union[int, None] = None, dirs_only=False, 
       files_only=False, args=None) -> List[Dict[str, Union[int, str]]]: ...
def about(path: str) -> Dict: ...
def size(path: str, args: List[str] = None) -> Dict: ...
def tree(path: str, args: List[str] = None) -> str: ...

File Listing and Information

File Management Operations

Essential file management functions including directory creation, file deletion, content output, and batch operations with comprehensive argument support.

def mkdir(path: str, args=None): ...
def delete(path: str, args=None): ...
def purge(path: str, args=None): ...
def cat(path: str, count: Optional[int] = None, head: Optional[int] = None, 
        offset: Optional[int] = None, tail: Optional[int] = None, args=None) -> str: ...

File Management

Hash Operations and Verification

Data integrity operations including hash generation, validation, and file comparison with support for multiple hash algorithms and checksum verification.

def hash(hash: Union[str, HashTypes], path: str, download=False, 
         checkfile: Optional[str] = None, output_file: Optional[str] = None,
         args: List[str] = None) -> Union[None, str, bool, Dict[str, str], Dict[str, bool]]: ...
def check(source: str, dest: str, combined: str = None, size_only: bool = False,
          download: bool = False, one_way: bool = False, args: List[str] = None
          ) -> Tuple[bool, List[Tuple[str, str]]]: ...

Hash Operations

Public Link Management

Functions for generating, managing, and removing public links to files and directories with expiration support where available.

def link(path: str, expire: Union[str, None] = None, unlink=False, args=None) -> str: ...

Public Links

Configuration and System

System-level operations including installation checking, version management, configuration file handling, and logging control.

def is_installed() -> bool: ...
def version(check=False, args: List[str] = None) -> Union[str, Tuple[str]]: ...
def set_config_file(config_file: str): ...
def set_log_level(level: int): ...

Configuration and System

Types

Core Types

from typing import Dict, List, Union, Optional, Callable, Tuple

# Progress listener callback type
ProgressListener = Callable[[Dict], None]

# Transfer operation parameters
TransferArgs = Optional[List[str]]

Hash Types

from enum import Enum

class HashTypes(Enum):
    crc32 = "crc32"
    dropbox = "dropbox" 
    hidrive = "hidrive"
    mailru = "mailru"
    md5 = "md5"
    quickxor = "quickxor"
    sha1 = "sha1"
    sha256 = "sha256"
    sha512 = "sha512"
    whirlpool = "whirlpool"

Remote Types

from enum import Enum

class RemoteTypes(Enum):
    # Major cloud providers
    onedrive = "onedrive"
    drive = "drive"  # Google Drive
    dropbox = "dropbox"
    box = "box"
    s3 = "s3"  # Amazon S3
    azureblob = "azureblob"
    
    # Storage systems (72 total providers supported)
    local = "local"
    sftp = "sftp"
    ftp = "ftp"
    webdav = "webdav"
    # ... and 65+ additional cloud storage providers

Exception Types

class RcloneException(ChildProcessError):
    def __init__(self, description: str, error_msg: str): ...
    
    # Properties
    description: str  # High-level error description
    error_msg: str    # Detailed error message from rclone