| 1 |
###### |
| 2 |
pyudev |
| 3 |
###### |
| 4 |
|
| 5 |
pyudev is a LGPL_ licensed, pure Python_ binding for libudev_, the device and |
| 6 |
hardware management and information library for Linux. It supports almost all |
| 7 |
libudev_ functionality. You can enumerate devices, query device properties and |
| 8 |
attributes or monitor devices, including asynchronous monitoring with threads, |
| 9 |
or within the event loops of Qt, Glib or wxPython. |
| 10 |
|
| 11 |
The binding supports CPython_ 3 and compatible versions of PyPy_. |
| 12 |
It is tested against udev 151 or newer, earlier versions of udev |
| 13 |
as found on dated Linux systems may work, but are not officially supported. |
| 14 |
|
| 15 |
|
| 16 |
Usage |
| 17 |
----- |
| 18 |
|
| 19 |
Usage of pyudev is quite simply thanks to the power of the underlying udev |
| 20 |
library. Getting the labels of all partitions just takes a few lines: |
| 21 |
|
| 22 |
>>> import pyudev |
| 23 |
>>> context = pyudev.Context() |
| 24 |
>>> for device in context.list_devices(subsystem='block', DEVTYPE='partition'): |
| 25 |
... print(device.get('ID_FS_LABEL', 'unlabeled partition')) |
| 26 |
... |
| 27 |
boot |
| 28 |
swap |
| 29 |
system |
| 30 |
|
| 31 |
The website_ provides a detailed `user guide`_ and a complete `API reference`_. |
| 32 |
|
| 33 |
|
| 34 |
Support |
| 35 |
------- |
| 36 |
|
| 37 |
Please report issues and questions to the issue tracker, but respect the |
| 38 |
following guidelines: |
| 39 |
|
| 40 |
- Check that the issue has not already been reported. |
| 41 |
- Check that the issue is not already fixed in the ``master`` branch. |
| 42 |
- Open issues with clear title and a detailed description in grammatically |
| 43 |
correct, complete sentences. |
| 44 |
- Include the Python version and the udev version (see ``udevadm --version``) in |
| 45 |
the description of your issue. |
| 46 |
|
| 47 |
|
| 48 |
Development |
| 49 |
----------- |
| 50 |
|
| 51 |
The source code is hosted on GitHub_:: |
| 52 |
|
| 53 |
git clone git://github.com/pyudev/pyudev.git |
| 54 |
|
| 55 |
Please fork the repository and send pull requests with your fixes or new |
| 56 |
features, but respect the following guidelines: |
| 57 |
|
| 58 |
- Read `how to properly contribute to open source projects on GitHub |
| 59 |
<http://gun.io/blog/how-to-github-fork-branch-and-pull-request/>`_. |
| 60 |
- Understand the `branching model |
| 61 |
<http://nvie.com/posts/a-successful-git-branching-model/>`_. |
| 62 |
- Write `good commit messages |
| 63 |
<http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_. |
| 64 |
- Add unit tests if possible (refer to the `testsuite documentation |
| 65 |
<http://pyudev.readthedocs.org/en/latest/tests/index.html>`_). |
| 66 |
- Add API documentation in docstrings. |
| 67 |
- Open a `pull request <https://help.github.com/articles/using-pull-requests>`_ |
| 68 |
that relates to but one subject with a clear title and description in |
| 69 |
grammatically correct, complete sentences. |
| 70 |
|
| 71 |
|
| 72 |
.. _LGPL: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html |
| 73 |
.. _Python: http://www.python.org/ |
| 74 |
.. _CPython: http://www.python.org/ |
| 75 |
.. _PyPy: http://www.pypy.org/ |
| 76 |
.. _libudev: https://www.freedesktop.org/software/systemd/man/libudev.html |
| 77 |
.. _website: http://pyudev.readthedocs.org |
| 78 |
.. _user guide: http://pyudev.readthedocs.org/en/latest/guide.html |
| 79 |
.. _api reference: http://pyudev.readthedocs.org/en/latest/api/index.html |
| 80 |
.. _issue tracker: http://github.com/pyudev/pyudev/issues |
| 81 |
.. _GitHub: http://github.com/pyudev/pyudev |
| 82 |
.. _git: http://www.git-scm.com/ |
| 83 |
|
| 84 |
|
| 85 |
Request a New Release |
| 86 |
--------------------- |
| 87 |
I will be doing regular releases of this project every August and October, |
| 88 |
shortly after Fedora releases are branched from rawhide. |
| 89 |
|
| 90 |
If you believe an extra release would help you in some way, please file an |
| 91 |
issue, explaining why you need the new release, and I expect I'll put one up. |
| 92 |
|
| 93 |
Why should you explain why you need the new release? Well, it is helpful to me, |
| 94 |
because pyudev is not at all part of my regular work, and I tend not to know |
| 95 |
very much about how it is used these days. |