Async local/remote file ops over SSH (scp/rsync) with robust defaults and Python bindings
Project description
async_server_ops (robust 0.3.0)
Async, robust file operations:
- Local (tokio fs)
- Remote via OpenSSH (
scp) with optional rsync (auto-fallback if missing) - Non-interactive defaults (BatchMode, ConnectTimeout, ServerAlive*)
- Correct
scpport flag (-P), separate fromssh -p - Optional password mode via
sshpass -e(setpassword), otherwise key-based
Build (Rust)
cargo build
Build (Python)
pip install maturin
maturin develop -F python # dev install into venv
# or build wheels:
maturin build -F python --release --manylinux 2014
Python usage
import asyncio
from async_server_ops import ServerManagerPy as ServerManager, PyRemoteConfig as RemoteConfig
async def main():
cfg = RemoteConfig(
host="192.168.222.61",
user="administrator",
key_path="~/.ssh/id_ed25519",
port=22,
prefer_rsync=False, # rsync optional; scp is default path
# password=None, # set if you really must use passwords (requires sshpass on client)
# robust non-interactive defaults already applied; you can add more:
ssh_extra_args=[
"-o","IdentitiesOnly=yes",
"-o","BatchMode=yes",
"-o","ConnectTimeout=8",
"-o","ServerAliveInterval=5","-o","ServerAliveCountMax=2",
],
)
m = ServerManager.remote(cfg)
# Remote file to local
rem = "/home/administrator/FoodIpadStorage/temp/dksl_c4db8429.pdf"
await m.download_file(rem, "file.pdf")
print("downloaded")
# Upload back
await m.create_dir_all("/tmp/ops_demo")
await m.upload_file("file.pdf", "/tmp/ops_demo/file.pdf")
print("uploaded")
asyncio.run(main())
Preflight check
ok = await m.preflight() # checks ssh/scp locally, connectivity, and remote rsync presence
print("preflight:", ok)
Notes
- Install
rsyncon both sides if you setprefer_rsync=True. Otherwise scp is used. - If you use password auth, install
sshpasson the client (the lib passes it via envSSHPASSsafely). - For production, load your key into ssh-agent to avoid prompts.
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
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 async_server_ops-0.3.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: async_server_ops-0.3.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 64.1 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8583a978ffcc38a2a6093a559d7aed38d4c54e64892ef0f9f6cee350d66e5c38
|
|
| MD5 |
f89d0bad32c13a9df2d2080ce2b97b61
|
|
| BLAKE2b-256 |
3eb535a778187b6b721dde87f677e6b4197f233bb136b20b804ac5fe9991cb9c
|