Event-driven pub/sub wrapper around udisksctl monitor (Linux)
Project description
udisks-monitor
Event-driven pub/sub wrapper around udisksctl monitor (Linux).
One lightweight dependency (strip-ansi). Parses the human-readable output of
udisksctl monitor into typed event dataclasses with wall-clock timestamps,
dispatching to subscribers via an in-process event bus.
Install
pip install udisks-monitor
Quickstart
from udisks_monitor import UdisksMonitor, DevicePropertyChanged, JobProperties
mon = UdisksMonitor()
# Subscribe by event type and filter
@mon.on(DevicePropertyChanged, device='loop0', property_='BackingFile')
def on_backing(evt):
if not evt.value:
print(f"{evt.device_name} detached")
@mon.on(JobProperties, operation='filesystem-mount')
def on_mount(evt):
print(f"mount job for {evt.objects}")
mon.start()
mon.join()
Events
| Event | When |
|---|---|
DevicePropertyChanged |
A property on any device interface changed |
InterfaceAdded |
A D-Bus interface appeared on a device |
InterfaceRemoved |
A D-Bus interface was removed |
JobAdded |
A UDisks2 job was created |
JobProperties |
The operation and target objects of a job |
JobCompleted |
A job finished (success/failure) |
JobRemoved |
A job object was torn down |
All events carry a timestamp: str field with the HH:MM:SS.mmm wall-clock
time from udisksctl monitor.
Subscription filters
bus = EventBus()
# By event type
bus.subscribe(fn, event_type=DevicePropertyChanged)
# By operation string (matches JobProperties with that operation)
bus.subscribe(fn, event_type='filesystem-mount')
# By device name
bus.subscribe(fn, device='loop0')
# By D-Bus interface
bus.subscribe(fn, interface='org.freedesktop.UDisks2.Loop')
# By property name
bus.subscribe(fn, property_='BackingFile')
# Combined
bus.subscribe(fn,
event_type=DevicePropertyChanged,
device='loop0',
property_='MountPoints')
# Decorator style
@bus.on(DevicePropertyChanged, device='loop0', property_='BackingFile')
def handler(evt): ...
Nix
{
inputs.udisks-monitor.url = "github:MBanucu/udisks-monitor";
}
License
GPL-3.0-only
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file udisks_monitor-0.2.0.tar.gz.
File metadata
- Download URL: udisks_monitor-0.2.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7aa2be3c40fd9fe4d87bfe6bcbc070d337c5ff52bd113da1dc712f2f09ab124
|
|
| MD5 |
ebe76ed2eca8c9637b142d35049760f6
|
|
| BLAKE2b-256 |
95dba8577e6817e65ee076f139e93ccf79346d658c390d02fb677004460edf0e
|
Provenance
The following attestation bundles were made for udisks_monitor-0.2.0.tar.gz:
Publisher:
publish.yml on MBanucu/udisks-monitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
udisks_monitor-0.2.0.tar.gz -
Subject digest:
c7aa2be3c40fd9fe4d87bfe6bcbc070d337c5ff52bd113da1dc712f2f09ab124 - Sigstore transparency entry: 1841096361
- Sigstore integration time:
-
Permalink:
MBanucu/udisks-monitor@e6bb5c049ac06783cd26be1b0a4cbdb8bc8b651e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MBanucu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e6bb5c049ac06783cd26be1b0a4cbdb8bc8b651e -
Trigger Event:
push
-
Statement type:
File details
Details for the file udisks_monitor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: udisks_monitor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eac00e4f3b9fb8a1964bfe1f60c4b885b30b3e7967f50e2db1929220e1e5cd59
|
|
| MD5 |
3551b569640deff0139acaa4a7e2b606
|
|
| BLAKE2b-256 |
7f0996bdb74a31444df88c1a8e95dde0f5b6c558098385f80b1bab4d0208a90d
|
Provenance
The following attestation bundles were made for udisks_monitor-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on MBanucu/udisks-monitor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
udisks_monitor-0.2.0-py3-none-any.whl -
Subject digest:
eac00e4f3b9fb8a1964bfe1f60c4b885b30b3e7967f50e2db1929220e1e5cd59 - Sigstore transparency entry: 1841096437
- Sigstore integration time:
-
Permalink:
MBanucu/udisks-monitor@e6bb5c049ac06783cd26be1b0a4cbdb8bc8b651e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/MBanucu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e6bb5c049ac06783cd26be1b0a4cbdb8bc8b651e -
Trigger Event:
push
-
Statement type: