Skip to main content

TinySync is a two-path synchronization algorithm implemented in pure Python that can synchronize files between any two kinds of backends.

Project description

TinySync

TinySync is a two-path synchronization algorithm implemented in pure Python that can synchronize files between any two kinds of backends. A backend could be a local file system, a WebDAV server, or any other user-defined backend. The synchronization algorithm is abstracted from the project syncrclone. In principle, this project is compatible with any operating system, although most testing has been conducted on Ubuntu.

Installation

pip install tinysync

Examples

Synchronization between Local Directory and WebDAV

This example demonstrates synchronizing a remote storage (WebDAV) 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.syncronization(backendA,backendB)

Synchronization between Local Directory and SSH Server

In this example, files are synchronized 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.syncronization(backendA,backendB)

Synchronization between Any Two Backends

This functionality allows synchronization between any two remote storage locations. The machine running this code acts as a "working machine" and retains no information about the two backends. All state information is stored on the backend side.

User-defined Backend

For general cases, you can define your own backend interface by creating a new backend class. Detailed methods and implementation examples can be found in tinysync.backend.abc

from tinysync.backend.abc import Backend

class YourBackend(Backend):
    
    def __init__(...):
        ...


    def listPath(self,...):
        ...

    ...

Currently Implemented Backends

  • tinysync.backend.LocalFS
  • tinysync.backend._WebDAV
  • tinysync.backend.NixSSH

more ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tinysync-0.0.12-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file tinysync-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: tinysync-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for tinysync-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 2052a88423401c7a18ad6391afd4ae559e1f2d60051865ecd2d0bd25e75175cd
MD5 12ab3dd6dc341b52f1358eac31512357
BLAKE2b-256 90098d0682cf96b59b270ae68f0e538fdf83271f72376647ba76107aff679644

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page