Registry / devops / sysrsync

sysrsync

JSON →
library1.1.1pypypi✓ verified 83d ago

sysrsync is a simple and safe Python wrapper designed to execute the system's `rsync` command-line utility. It provides a programmatic interface to construct `rsync` commands, helping to prevent common shell injection vulnerabilities and simplify complex `rsync` operations. The current version is 1.1.1, and it maintains an active but infrequent release cadence, primarily for bug fixes and minor enhancements.

pip install sysrsync
INSTALL
IMPORT
SIG · SYSRSYNC
S
sysrsync
devopspythonv1.1.1
Install
1.6s avg
Import
37ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.040s · 18MB
glibc
py 3.103.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.
fix
Upgrade 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.
fix
Ensure `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.
fix
If 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.
fix
Always 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.

Agent activity
43 hits · last 30 days
node
40
OpenAI (training)
1
Resources
sysrsync — pip install sysrsync · libregistry