Install & Compatibility
Where this runs
tested against v1.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.040s · 18MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.6s · import 0.034s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
run
✓ from sysrsync import run
✗ import sysrsync
This quickstart demonstrates how to perform a local file synchronization using `sysrsync.run`. It uses the `source` and `destination` arguments, along with standard `rsync` options. The `sync=True` argument ensures the function waits for the `rsync` process to complete and returns a `subprocess.CompletedProcess` object. It also includes basic error handling for `sysrsync.exceptions.SysrsyncError`.
import sysrsync
import os
# Create dummy files for demonstration
if not os.path.exists("my_source_folder"): os.makedirs("my_source_folder")
with open("my_source_folder/file1.txt", "w") as f: f.write("Hello")
with open("my_source_folder/file2.txt", "w") as f: f.write("World")
# Example: Local to Local sync (replace with your actual paths)
# This requires rsync to be installed on your system.
# In a real scenario, 'destination_ssh_user' and 'destination_ssh_host' would be used for remote sync.
print("Attempting local sync...")
try:
result = sysrsync.run(
source="my_source_folder/", # Trailing slash means copy contents of folder
destination="./my_destination_folder/",
options=["-a", "--delete", "-v"],
sync=True # Wait for completion
)
print(f"Rsync completed with exit code: {result.returncode}")
print(f"STDOUT:\n{result.stdout.decode()}")
if result.stderr: print(f"STDERR:\n{result.stderr.decode()}")
except sysrsync.exceptions.SysrsyncError as e:
print(f"Rsync failed: {e}")
print(f"STDOUT:\n{e.result.stdout.decode()}")
if e.result.stderr: print(f"STDERR:\n{e.result.stderr.decode()}")
# Clean up dummy files
import shutil
if os.path.exists("my_source_folder"): shutil.rmtree("my_source_folder")
if os.path.exists("my_destination_folder"): shutil.rmtree("my_destination_folder")
Debug
Known issues
gotchaPrior to version 1.1.1, `sysrsync` had a bug that could lead to false strict host checking errors or unexpected SSH connection failures when using remote destinations. This often required manual intervention or workarounds.fixUpgrade to `sysrsync` version 1.1.1 or newer to benefit from the bug fix for strict host checking issues.
affects: <1.1.1
gotchaThe `sysrsync` library is a wrapper around the system's `rsync` command. If `rsync` is not installed or not in your system's PATH, `sysrsync` calls will fail with an OS-level error indicating the command cannot be found.fixEnsure `rsync` is installed on your operating system (e.g., `sudo apt-get install rsync` on Debian/Ubuntu, `brew install rsync` on macOS) and accessible via your system's PATH.
affects: All versions
breakingIn version 0.3.0, the functionality that checks if the remote source exists was disabled. This means `sysrsync` no longer performs an implicit check for remote source existence before initiating the `rsync` transfer.fixIf your application relied on `sysrsync` to implicitly verify remote source existence, you will need to add explicit checks in your code before calling `sysrsync.run` when upgrading from versions older than 0.3.0.
affects: >=0.3.0 (behavioral change from <0.3.0)
gotchaUnderstanding `rsync`'s trailing slash behavior is critical. A trailing slash on the source path (`source="folder/"`) copies the *contents* of the folder, while no trailing slash (`source="folder"`) copies the folder itself into the destination. Misunderstanding this is a common source of unexpected sync results.fixAlways be explicit with trailing slashes in your `source` and `destination` paths based on whether you want to copy the folder's contents or the folder itself.
affects: All versions (inherent `rsync` behavior)
Upgrade
Version history
1.1.1latest on PyPI · released Apr 24, 2023
Audit
Dependencies
No dependency data recorded yet.