TinySync is a two-path (bi-direction) synchronization algorithm implemented in pure Python that can synchronize files between any two kinds of backends.
Project description
TinySync README
TinySync
TinySync is a two-way synchronization algorithm implemented in pure Python, enabling file synchronization between any two types of backends. A backend can be a local file system, a WebDAV server, or any other user-defined storage medium. The synchronization algorithm is adapted from the syncrclone project. In principle, this project is compatible with all operating systems, though most testing has been performed on Ubuntu.
Installation
pip install tinysync
Examples
Synchronization between Local Directory and WebDAV
This example illustrates how to synchronize a remote WebDAV storage with a local directory.
import tinysync
# set a local dir
backendA = tinysync.backend.LocalFS(dirPath="/home/XXX/Desktop/p1")
# set another backend on webdav
options = {'webdav_hostname': "...",'webdav_login': "...",'webdav_password':"..."}
backendB = tinysync.backend._WebDAV(dirPath='p2',options=options)
# run sync method
tinysync.synchronization(backendA,backendB)
Synchronization between Local Directory and SSH Server
This example demonstrates file synchronization between a local directory and a remote directory on an SSH server.
import tinysync
# set one backend
config={"hostname":'...',"username":'...',"password":'...',}
remote_path = '/home/user/path' # the remote directory to list
backendA = tinysync.backend.NixSSH(dirPath=remote_path,paramikoConfig=config)
# set another backend
options = {'webdav_hostname':"...",'webdav_login':"...",'webdav_password':"...",}
backendB = tinysync.backend._WebDAV(dirPath='p2',options=options)
# run sync method
tinysync.synchronization(backendA,backendB)
Synchronization between Any Two Backends
This feature supports synchronization between any two remote storage locations. The machine executing this code acts as a "working machine" and does not retain any information about the two backends. All state data is stored on the backend side.
Other Backends
Rclone example:
rclone = tinysync.backend.Rclone(dirPath="disk:path/to/here")
User-defined Backend
For general use cases, you can define a custom backend interface by creating a new backend class. Detailed methods and implementation examples are available in tinysync.backend.abc.
from tinysync.backend.abc import Backend
class YourBackend(Backend):
def __init__(...):
...
def listPath(self,...):
...
...
Notice
Do NOT delete the workdir (default: .tinysync) from one backend while retaining it on the other. This will result in the deletion of all files in the backend where the workdir was retained. This behavior, inherited from syncrclone, is not ideal, but it will not be modified. To perform a full resynchronization, it is safe to delete the workdir from both backends.
Currently Implemented Backends
-
tinysync.backend.LocalFS -
tinysync.backend._WebDAV -
tinysync.backend.NixSSH -
tinysync.backend.FTP(Example:FTP(dirPath="", host='127.0.0.1', username='123', password='456')) -
tinysync.backend.Rclone(consider using syncrclone)
More backends coming soon...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinysync-0.0.21-py3-none-any.whl.
File metadata
- Download URL: tinysync-0.0.21-py3-none-any.whl
- Upload date:
- Size: 54.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebd369d4d1269f621c121aa08f59d5b97293b050c7a78b658bb80c5496bc54f5
|
|
| MD5 |
9d3dcc59ecd46a860e4437438f82daa6
|
|
| BLAKE2b-256 |
67be8ef56e18dacabeb501c3ff7db0e35fff7067a7652a441dafa3ce8914e4a5
|