pyudev
A libudev binding
What it is and what it does
pyudev wraps the libudev library to give Python code direct access to Linux device and hardware information. It lets you list all devices on the system, filter by subsystem or properties, read device attributes, and monitor for device changes in real time. The binding is pure Python and supports both CPython 3 and PyPy, making it portable across Python implementations on Linux systems.
Typical use cases include system utilities that need to detect when USB devices are plugged in, applications that enumerate block devices or network interfaces, and tools that monitor hardware state. The library handles both synchronous queries and asynchronous monitoring via threads or event loops (Qt, Glib, wxPython).
Use it for:
- Detect and react to USB device hotplug events in a system utility or daemon.
- Enumerate all block devices and partitions to build a device list for a storage management tool.
- Query device properties and attributes (labels, UUIDs, device types) without shelling out to udevadm.
- Monitor hardware changes asynchronously within a Qt or Glib event loop in a desktop application.
- Build a hardware inventory tool that reads device capabilities and identifiers from the kernel.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyudev is a pure Python binding for libudev that lets you enumerate, query, and monitor Linux devices and hardware from Python code.
Yes. pyudev is stable (Production/Stable status), actively maintained, has no security vulnerabilities, and solves a real problem for Linux system tools. The LGPL copyleft license is standard for system libraries and poses no barrier to most use. Install it if you need programmatic access to udev from Python on Linux; it is the standard binding for this task.
Install
pyudev on PyPI
pip
pip install pyudevuv
uv add pyudevpoetry
poetry add pyudevInstalling pyudev
Before you install
Low friction install with no runtime dependencies. Actively maintained with regular releases; last commit 2026-07-31. Requires Python 3.9 or newer and a Linux system with libudev present.
License in practice
Licensed under LGPL 2.1+, a copyleft license. Derivative works and modifications must be released under compatible terms; proprietary applications can use it as a library but must disclose the license.
Quickstart
import pyudev
context = pyudev.Context()
for device in context.list_devices(subsystem='block', DEVTYPE='partition'):
print(device.get('ID_FS_LABEL', 'unlabeled partition'))
Requires Linux with libudev installed; does not work on Windows or macOS. Requires Python 3.9 or newer.
Verify before relying
- Whether libudev must be pre-installed on the system or is bundled/installed as part of pyudev setup.
- Exact minimum udev version required; description mentions 151 or newer are tested but earlier versions may work.
Package facts
| License | LGPL 2.1+ (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 310 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,475,835/month — #3,861 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyudev-0.24.4-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
evdevProvides Python bindings to Linux's evdev and…
permissive · top 5,000 on PyPI
spidevProvides Python bindings to interact with SPI…
permissive · top 15,000 on PyPI
pyocdpyOCD is a Python-based debugger and programmer…
permissive · top 5,000 on PyPI
winrt-Windows.Devices.EnumerationProvides Python bindings to Windows Runtime…
permissive · top 15,000 on PyPI
ft4222Provides Python bindings to LibFT4222, enabling…
permissive · top 15,000 on PyPI
hidapiProvides a Python interface to HIDAPI, enabling…
unclear · top 5,000 on PyPI
libusb-packageBundles libusb shared libraries for multiple…
permissive · top 5,000 on PyPI
jeepneyJeepney is a pure Python implementation of…
permissive · top 1,000 on PyPI
pyjoulescope-driverPython bindings for the Joulescope DC energy…
permissive · top 15,000 on PyPI
libpciProvides Python bindings to libpci, allowing…
copyleft · top 15,000 on PyPI