pyudev – pure Python libudev binding — pyudev 0.24.4 documentation

# pyudev – pure Python libudev binding

pyudev 0.24.4 (Changelog, installation)

pyudev is a LGPL licenced, pure Python 3 binding to libudev, the device and hardware management and information library of Linux.

Almost the complete libudev functionality is exposed. You can:

- Enumerate devices, filtered by specific criteria (`pyudev.Context`)

- Query device information, properties and attributes,

- Monitor devices, both synchronously and asynchronously with background threads, or within the event loops of Qt (`pyudev.pyqt5`, `pyudev.pyqt4`, `pyudev.pyside`), glib (`pyudev.glib`) and wxPython (`pyudev.wx`).

## Documentation

Thanks to the power of libudev, usage of pyudev is very simple. Getting the labels of all partitions just takes a few lines:

    >>> import pyudev
    >>> context = pyudev.Context()
    >>> for device in context.list_devices(subsystem='block', DEVTYPE='partition'):
    ...     print(device.get('ID_FS_LABEL', 'unlabeled partition'))
    ...
    boot
    swap
    system

A user guide gives an introduction into common operations and concepts of pyudev, the API documentation provides a detailed reference:

- Installation
  - Python versions and implementations
  - Dependencies
  - Installation from Cheeseshop
  - Installation from source code
- User guide
  - Getting started
  - A note on versioning
  - Enumerating devices
  - Accessing individual devices directly
  - Querying device information
  - Examing the device hierarchy
  - Monitoring devices
- API documentation
  - pyudev
  - pyudev.wx

## Support

Please report issues, bugs and questions to the issue tracker, but respect the following guidelines:

- Check that the issue has not already been reported.

- Check that the issue is not already fixed in the `master` branch.

- Open issues with clear title and a detailed description in grammatically correct, complete sentences.

- Include the Python version and the udev version (see `udevadm --version`) in the description of your issue.

## Development

The source code is hosted on GitHub:

    git clone https://github.com/lunaryorn/pyudev.git

If you want to contribute to pyudev, please read the guidelines for contributions and the testsuite documentation.

- Contribute
- Testsuite documentation
  - Test running
  - `plugins` – Testsuite plugins

## Endorsements

If you’re using pyudev and want to say something about it please add yourself to the endorsements page.

- pyudev Users

## Other reading

- Changelog
- Licencing