PyRCLONE
A Python wrapper for rclone.
This package, available on PyPI, conveniently includes the rclone binary (version v1.62.2) eliminating the need for pre-installation of rclone. It caters to various operating systems like Windows, Mac, and Linux, and supports both amd64 and x86_64 architectures. When a user downloads the package, the appropriate rclone binary file is installed based on their system type.
Install
pip install pyrclone-wrapper
Usage
from pyrclone 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:
copyCopy files from source to dest, skipping already copiedsyncMake source and dest identical, modifying destination only.listremotesList all the remotes in the config file.lsList the objects in the path with size and path.lsjsonList directories and objects in the path in JSON format.deleteRemove 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 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 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
python-rclone ( base on this project and improve it )
Metadata
Release files for pyrclone-wrapper 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| pyrclone_wrapper-0.0.3-py3-none-manylinux1_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64 | Details |
| pyrclone_wrapper-0.0.3-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 / pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl
| Download URL | pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f61b704df748b6cba8d1382cd78fb8a93878a21008ac663452ca03e8847992c5
|
|
BLAKE2b-256 checksum How to use checksums |
0be74ae6f6e5f600023a1c36f0ab9cea759e56eaba41f7ca4483e939ca023530
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / pyrclone_wrapper-0.0.3-py3-none-manylinux1_x86_64.whl
| Download URL | pyrclone_wrapper-0.0.3-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 |
7782204975de2d41b363ab934f213293bd72e3b517ef6efd26be59ec51da9a20
|
|
BLAKE2b-256 checksum How to use checksums |
019903b7bbc2d6c97a448c22234660dd2a52b2e7784c57327d79b2b25547965d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / pyrclone_wrapper-0.0.3-py3-none-macosx_10_9_x86_64.whl
| Download URL | pyrclone_wrapper-0.0.3-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 |
e00187e28e7ffbedd4cc6289dd4a72f3db5a7aeca7c5bc217429bf65a80f3fce
|
|
BLAKE2b-256 checksum How to use checksums |
5c27a1e36c53399067c2f4184694a5b7e7cb129c818d70a3f6440084f711c9bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|