Registry / http-networking / sftpretty

sftpretty

JSON →
library1.2.2pypypi✓ verified 85d ago

A pretty, simple SFTP wrapper around paramiko with a high-level API for secure file transfer. Current version is 1.2.1, requires Python >=3.6. Release cadence is occasional, with recent releases roughly every few months.

pip install sftpretty
INSTALL
IMPORT
SIG · SFTPRETTY
S
sftpretty
http-networkingpythonv1.2.2
Install
2.9s avg
Import
828ms
Disk
40MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.2 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.860s · 42MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.796s · 42MB
40MB installed
● package 40MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CnOpts
from sftpretty import CnOpts
Connection
from sftpretty import Connection
SFTPError
from sftpretty import SFTPError

Basic connection and directory listing. Disables host key verification for simplicity; use proper hostkeys in production.

from sftpretty import Connection cnopts = CnOpts() cnopts.hostkeys = None # disable host key checking (for demo only) with Connection('example.com', username='user', password='pass', cnopts=cnopts) as sftp: sftp.listdir() print('Connected')
Debug
Known issues
gotchasftpretty uses paramiko under the hood, so it inherits paramiko's GPL license. Ensure your project is compatible.
fix
Review paramiko's license implications before incorporating into proprietary software.
affects: all
gotchaWhen using connection as a context manager (with statement), the connection closes upon exit. Do not attempt to use sftp object after the block ends.
fix
Perform all file operations inside the with block.
affects: all
deprecatedThe 'cnopts' parameter in Connection constructor expects a CnOpts object; passing a dict is deprecated in some versions. Use CnOpts() explicitly.
fix
from sftpretty import CnOpts; cnopts = CnOpts(); Connection(..., cnopts=cnopts)
affects: >=1.2.0
gotchaHost key checking is enabled by default. If you don't have the server's host key, the connection will fail. Use cnopts.hostkeys = None to disable (insecure) or cnopts.hostkeys.load('known_hosts') to add keys.
fix
Load known hosts file with cnopts.hostkeys.load('path/to/known_hosts') or set cnopts.hostkeys = None for testing only.
affects: all
breakingIn version 1.0.0, the API changed from `sftpretty.Connection(...)` to `Connection(...)` (import changes). Older code using `from sftpretty import sftpretty` will break.
fix
Change imports to `from sftpretty import Connection` and use `Connection(...)` directly.
affects: >=1.0.0
Errors
Common errors & fixes
AttributeError: module 'sftpretty' has no attribute 'Connection'
Old import style (from sftpretty import sftpretty; sftpretty.Connection) used with sftpretty >=1.0.0 where API changed.
fix
from sftpretty import Connection
ImportError: cannot import name 'CnOpts'
Attempting to import CnOpts from a wrong location or an older version lacking that class.
fix
Use `from sftpretty import CnOpts`; ensure sftpretty version >=1.0.0.
SSHException: Server 'example.com' not found in known_hosts
Host key verification fails because the server's host key is not in the known_hosts file.
fix
Either disable host key checking (cnopts.hostkeys = None) or load the known_hosts file with cnopts.hostkeys.load('path/to/known_hosts').
TypeError: __init__() got an unexpected keyword argument 'port'
Connection constructor does not accept a 'port' argument; port is specified via hostname like 'host:port' or via the 'port' keyword in older paramiko but sftpretty expects it in the host string.
fix
Use connection = Connection('example.com:22', username='user', password='pass') or separate port argument? Actually sftpretty does accept port as an integer argument in version 1.2.x. Check docs. If error persists, use host:port format.
Upgrade
Version history
1.2.2latest on PyPI · released May 11, 2026
Audit
Dependencies
paramikorequiredCore SSH/SFTP protocol implementation
Agent activity
34 hits · last 30 days
node
22
OpenAI (training)
1
Resources
sftpretty — pip install sftpretty · libregistry