ansible-pylibssh
Python bindings for libssh client specific to Ansible use case
What it is and what it does
ansible-pylibssh is a Python wrapper around the libssh C library, providing direct access to SSH client functionality optimized for Ansible's use case. It bridges the gap between Python and libssh by exposing session management, connection handling, and SSH operations through a Python API, allowing Ansible and other tools to perform SSH operations programmatically without shelling out to external commands.
The package is a compiled C extension (Cython-based) that requires libssh 0.9.0+ to be installed on the system. Recent versions (1.4.0) integrate libssh logging into Python's standard logging system, allowing fine-grained control over SSH debug output and performance tuning. It supports Python 3.9 through 3.14 and provides prebuilt wheels for macOS and multiple Linux architectures, though custom builds require a C compiler and libssh development headers.
Use it for:
- Integrate SSH connectivity into Ansible automation without spawning external SSH processes.
- Debug SSH connection issues by routing libssh logs through Python's logging system and setting trace levels.
- Build custom SSH-based tools or orchestration scripts that need direct libssh functionality rather than subprocess wrappers.
- Support Ansible on platforms where native SSH binaries are unavailable or where direct C-level SSH control is required.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python bindings to libssh that provide SSH client functionality tailored for Ansible, enabling programmatic SSH connections and operations from Python.
Yes, with conditions. Install if you are building Ansible-related tools or need direct libssh integration in Python and have libssh 0.9.0+ available on your system. The copyleft license (LGPLv2+) requires careful review in proprietary contexts. The Pre-Alpha classifier suggests API stability is not guaranteed, so pin versions carefully. No known security vulnerabilities as of the fact sheet date.
Install
ansible-pylibssh on PyPI
pip
pip install ansible-pylibsshuv
uv add ansible-pylibsshpoetry
poetry add ansible-pylibsshInstalling ansible-pylibssh
Before you install
Medium install friction due to compiled C extension requiring libssh 0.9.0+ to be present on the system. Wheels are available for Python 3.9–3.14 across multiple architectures (x86_64, aarch64, ppc64le, s390x, armv7l) and macOS 15.0+, reducing build burden on supported platforms. Project is actively maintained with recent releases.
License in practice
Licensed under LGPLv2+, a copyleft license. Any derivative work or modification must be distributed under compatible terms; static linking or redistribution may require source disclosure. Suitable for open-source projects but requires careful review in proprietary contexts.
Quickstart
pip install ansible-pylibssh
from ansible_pylibssh import Session
ssh = Session()
ssh.connect(host='example.com', user='admin')
libssh 0.9.0 or later must be installed on the system; Python 3.9+ is required. Prebuilt wheels exist for common platforms but custom builds need a C compiler and libssh development headers.
Verify before relying
- Whether the package supports key-based authentication, password auth, and other standard SSH mechanisms beyond what the changelog mentions.
- Performance characteristics and typical use patterns within Ansible's infrastructure.
- Stability guarantees given the 'Pre-Alpha' development status classifier despite active maintenance.
Package facts
| License | LGPLv2+ (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 151 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 295,978/month — #7,907 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ansible_pylibssh-1.4.0-cp310-cp310-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp310-cp310-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp311-cp311-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp311-cp311-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp312-cp312-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_ppc64le.manylinux_2_28_ppc64le.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_s390x.manylinux_2_28_s390x.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; ansible_pylibssh-1.4.0-cp312-cp312-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl; ansible_pylibssh-1.4.0-cp313-cp313-macosx_15_0_x86_64.whl; ansible_pylibssh-1.4.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Keywords: cython, cext, libssh
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
ssh-pythonPython bindings to the libssh C library for SSH…
copyleft · top 15,000 on PyPI
ansibleAnsible is an IT automation system that handles…
copyleft · top 5,000 on PyPI
ansible-coreAnsible Core is the engine for agentless IT…
copyleft · top 5,000 on PyPI
ansible-compatProvides compatibility utilities for working…
permissive · top 5,000 on PyPI
ansible-creatorA CLI tool that scaffolds new Ansible projects…
permissive · top 15,000 on PyPI
ansible-baseAnsible-base is the core automation engine for…
copyleft · top 15,000 on PyPI
ansible-dev-toolsBundles and installs a curated suite of Ansible…
copyleft · top 15,000 on PyPI
jumpsshJumpSSH runs commands on remote servers through…
permissive · top 15,000 on PyPI
awxkitawxkit is the official command-line interface…
permissive · top 15,000 on PyPI
pygit2pygit2 provides Python bindings to libgit2,…
copyleft · top 5,000 on PyPI