skillfed

pyudev

A libudev binding

pyudev v0.24.4 1.5M downloads/30d#3,861 on PyPI175
Copyleft license LGPL 2.1+ Active released

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 pyudev

uv

uv add pyudev

poetry

poetry add pyudev

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: System :: HardwareTopic :: System :: Operating System Kernels :: Linux

Tags

linux device enumeration pythonudev binding pythonhardware monitoring linuxdevice properties querylibudev python wrapper
linux-hardwaredevice-managementsystem-integration

More Libraries packages