Skip to main content

PyRCLONE

A Python wrapper for rclone.

No need to install rclone separately as it is already included in this package. The binary file for version v1.62.2 is available for different operating systems including Windows, Mac, and Linux, as well as arch with amd64 and x86_64.

Install

pip install pyrclonetest

Usage

from pyrclone.rclone_wrapper import RCloneWrapper


config = {
    "remote_name": {
        'type': 'google cloud storage',
        'project_number': "project_number",
        'service_account_file': "path/to/service_account_file.json",
        'object_acl': 'private',
        'bucket_acl': 'private',
        'location': 'us',
        'storage_class': 'STANDARD'
    }
}
rclone = RCloneWrapper(config)
result = rclone.listremotes()
print(result.get('out'))
# b'remote_name:\n'
print(result.get('code'))
# 0
print(result.get('error'))
# b''

Implemented commands:

  • copy Copy files from source to dest, skipping already copied
  • sync Make source and dest identical, modifying destination only.
  • listremotes List all the remotes in the config file.
  • ls List the objects in the path with size and path.
  • lsjson List directories and objects in the path in JSON format.
  • delete Remove the contents of path.

Even if not all rclone commands have been exposed, it's possible to invoke any command using run_cmd method directly, as shown in the example bellow:

from pyrclone.rclone_wrapper import RCloneWrapper

config = {
    "local": {
        'type': 'local',
        'nounc': True,
    }
}
result = RCloneWrapper(config).run_cmd(command="lsd", extra_args=["local:/tmp", "-v", "--dry-run"])

Logging and Debugging

To see more info about which commands are executed, or what other messages they print, you can enable logging as the example bellow shows:

import logging
logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s %(name)s [%(levelname)s]: %(message)s")

from pyrclone.rclone_wrapper import RCloneWrapper

config = {
    "local": {
        'type': 'local',
        'nounc': True,
    }
}
rclone = RCloneWrapper(config)
result = rclone.listremotes()

Limitation

Only support windows, mac and, linux operating system and arch with amd64 and x86_64.

windwos: amd64

linux: amd64, x86_64

darwin(mac): amd64, x86_64

Developer guide

$ pip install wheel twine pytest
$ make test

Reference

https://github.com/ddragosd/python-rclone (base on this project and improve it)

Metadata

Release files for pyrclonetest 0.0.7

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

Built distributions (wheels)

Table of built distributions (wheels) for pyrclonetest 0.0.7
File Interpreter ABI Platform
pyrclonetest-0.0.7-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
pyrclonetest-0.0.7-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details
pyrclonetest-0.0.7-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 52.5 MB

Release files / pyrclonetest-0.0.7-py3-none-win_amd64.whl

Download URL pyrclonetest-0.0.7-py3-none-win_amd64.whl
Size 16.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
fe657c0aa821b554383eb2074a2b875a5c681beb983485baee5478d043a47459
BLAKE2b-256 checksum
How to use checksums
0bf31a3d617c983ee182c2037f5d94aaaa1b26698891051b0a2c711120fc6b59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / pyrclonetest-0.0.7-py3-none-manylinux1_x86_64.whl

Download URL pyrclonetest-0.0.7-py3-none-manylinux1_x86_64.whl
Size 16.5 MB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
72ed75032bd872dec62f9a67e5dafd0d2900b523494412fb12b949c86613e55c
BLAKE2b-256 checksum
How to use checksums
bd4d1d0e87216f94b514c759e9aec84892f6aa42397fa0f79ccf0b45b6736d4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / pyrclonetest-0.0.7-py3-none-macosx_10_9_x86_64.whl

Download URL pyrclonetest-0.0.7-py3-none-macosx_10_9_x86_64.whl
Size 19.7 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
c0553d40c966c0fe0812a7895bbe7ef8c244b355ea74eba47d16e65c97520c37
BLAKE2b-256 checksum
How to use checksums
f3c5aff3ffbe6e4d8f5a94f91c739109ebce64826a651680f69d8ef45bf41abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.0.7 This release

3 release files

0.0.4

3 release files

0.0.3

1 release file

0.0.2

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