nmcli
A python wrapper library for the network-manager cli client
What it is and what it does
nmcli wraps the NetworkManager command-line interface to let Python code query and control network connections, devices, and Wi-Fi operations directly. It exposes methods to list connections and devices, connect or disconnect from networks, modify connection profiles (IP addresses, gateways, DNS), and scan or join Wi-Fi networks. The library parses nmcli output into structured Python objects, removing the need to parse shell command results manually.
The package is designed for Linux systems running NetworkManager and requires either sudo access with NOPASSWD configuration or root privileges. It supports a broad subset of nmcli functionality—connection lifecycle (up, down, delete, reload), device management (connect, disconnect, status), and Wi-Fi operations (scan, connect, hotspot)—though some advanced features like agent configuration and connection editing are not yet wrapped.
Use it for:
- Automate Wi-Fi connection and disconnection in headless Linux applications or IoT devices
- Programmatically configure static IP addresses and network settings without manual nmcli calls
- Monitor device and connection status in network management or system administration tools
- Build network provisioning scripts that query available Wi-Fi networks and connect to them
- Manage multiple network profiles and switch between them in containerized or embedded environments
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
nmcli is a Python wrapper for the NetworkManager command-line client, allowing programmatic control of network connections, devices, and Wi-Fi operations on Linux systems.
Yes, if you need programmatic control of NetworkManager on Linux and can meet the sudo/root requirement. The package has low install friction, no external Python dependencies, active maintenance, and no known vulnerabilities. MIT licensing poses no restriction. Install only if your use case requires direct network management automation; it is not a general networking library.
Install
nmcli on PyPI
pip
pip install nmcliuv
uv add nmclipoetry
poetry add nmcliInstalling nmcli
Before you install
Low install friction with no runtime dependencies beyond NetworkManager itself. Active maintenance with recent commits and steady development.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
import nmcli
# List connections and devices
connections = nmcli.connection()
devices = nmcli.device()
# Connect to Wi-Fi
nmcli.device.wifi_connect('SSID', 'password')
# Modify connection settings
nmcli.connection.modify('SSID', {'ipv4.method': 'manual'})
Requires NetworkManager installed (e.g., `sudo apt install network-manager` on Debian) and a user account with sudo access to execute nmcli commands, or root privileges if `disable_use_sudo` is set.
Verify before relying
- Whether the package works on non-Linux systems or only POSIX Linux as classifiers suggest
- Current test coverage and stability guarantees for production network management tasks
- Performance characteristics when managing many connections or frequent state changes
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 62 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,346/month — #14,848 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nmcli-1.8.0-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
librouteroslibrouteros is a Python client library for the…
copyleft · top 15,000 on PyPI
python-miioPython library and CLI tool for controlling…
copyleft · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI
PyRICPyRIC provides programmatic control over Linux…
copyleft · top 15,000 on PyPI
flux-ledControls Magic Home and Surp Life WiFi LED…
copyleft · top 15,000 on PyPI
pywemoDiscovers and controls Belkin WeMo smart home…
permissive · top 15,000 on PyPI
aioruckusAsync Python client library for querying and…
permissive · top 15,000 on PyPI
aioqswAsync Python library for controlling QNAP QSW…
permissive · top 15,000 on PyPI
tplink-omada-clientA Python client library for interacting with…
permissive · top 15,000 on PyPI
python-kasaControl TP-Link Kasa and Tapo smart home…
copyleft · top 15,000 on PyPI