python-sdbus currently exposes sd_bus_open(), sd_bus_open_user(),
sd_bus_open_system_remote(host), and machine helpers, but there does not
appear to be a way to open an explicit D-Bus address from Python.
This makes it difficult to use libsystemd-supported transports such as:
unixexec:path=/usr/bin/ssh,argv1=host,argv2=systemd-stdio-bridge,argv3=--user
Use case: connect to a remote user bus over SSH via
systemd-stdio-bridge --user. This works if DBUS_SESSION_BUS_ADDRESS is set
before calling sdbus.sd_bus_open_user(), but mutating process-global
environment variables is awkward and unsafe when opening multiple clients
concurrently.
The underlying libsystemd APIs support this through
sd_bus_new() + sd_bus_set_address() + sd_bus_start() (and related
sd_bus_set_fd() / sd_bus_set_exec() APIs), but python-sdbus does not seem to
expose an equivalent API.
Would you consider adding an API such as:
sdbus.sd_bus_open_address(address: str) -> sdbus.SdBus
or exposing SdBus.set_address(address) before SdBus.start()?
Example desired usage:
address = (
"unixexec:path=/usr/bin/ssh,"
"argv1=my-host,"
"argv2=systemd-stdio-bridge,"
"argv3=--user"
)
bus = sdbus.sd_bus_open_address(address)
This would avoid relying on DBUS_SESSION_BUS_ADDRESS and would make custom
D-Bus transports usable from Python.
python-sdbus currently exposes
sd_bus_open(),sd_bus_open_user(),sd_bus_open_system_remote(host), and machine helpers, but there does notappear to be a way to open an explicit D-Bus address from Python.
This makes it difficult to use libsystemd-supported transports such as:
Use case: connect to a remote user bus over SSH via
systemd-stdio-bridge --user. This works ifDBUS_SESSION_BUS_ADDRESSis setbefore calling
sdbus.sd_bus_open_user(), but mutating process-globalenvironment variables is awkward and unsafe when opening multiple clients
concurrently.
The underlying libsystemd APIs support this through
sd_bus_new()+sd_bus_set_address()+sd_bus_start()(and relatedsd_bus_set_fd()/sd_bus_set_exec()APIs), but python-sdbus does not seem toexpose an equivalent API.
Would you consider adding an API such as:
or exposing
SdBus.set_address(address)beforeSdBus.start()?Example desired usage:
This would avoid relying on
DBUS_SESSION_BUS_ADDRESSand would make customD-Bus transports usable from Python.