Skip to content

v0.16.0

Latest

Choose a tag to compare

@aleivag aleivag released this 02 Dec 00:15
25fa007

pystemd 0.16.0: file descriptor store support, Unit.SetProperties, pystemd.utils.ns.join_namespaces, delegate= in pystemd.run, fixes for pystemd.run waits and pystemd.futures on systemd 259 / Python 3.14, crash and leak fixes in pystemd.dbuslib, py.typed and a PyInstaller hook.

Behaviour changes to check when upgrading:

  • DbusMessage.get_path(), get_interface(), get_member(), get_destination() and get_sender() return None for a header field the message lacks (they used to crash the interpreter)
  • DBus.match_signal no longer sets a metadata attribute on the callback
  • Using a closed DBus raises DBusError (it used to corrupt memory); sd-bus errors while building a message, and unbalanced ( in signatures, raise instead of being ignored

Changes:

  • Fix pystemd.run(wait=True) / wait_for_activation=True hanging forever on hosts where no other client is subscribed to systemd signals
  • Fix pystemd.run missing unit state changes when several D-Bus signals arrive at once
  • Fix pystemd.futures on Python 3.14+, where the default multiprocessing start method is no longer fork
  • Fix pystemd.futures ignoring User= on systemd >= 255
  • Fix pystemd.futures.TransientUnitPoolExecutor leaking its unit when the parent process is killed
  • Fix pystemd.run(wait_for_activation=True) hanging forever when the unit fails to start
  • Add delegate= to pystemd.run, a shortcut for extra={"Delegate": ...}
  • Add PrivatePIDs, ProtectHostnameEx and SystemCallErrorNumber to systemd1 KNOWN_UNIT_SIGNATURES
  • Add FileDescriptorStoreMax and FileDescriptorStorePreserve to systemd1 KNOWN_UNIT_SIGNATURES
  • Add fds= to pystemd.daemon.notify (sd_pid_notify_with_fds) and add pystemd.daemon.listen_fds_with_names (file descriptor store / named socket activation)
  • Add pystemd.daemon.store_fd and pystemd.daemon.store_fds helpers for the file descriptor store
  • Add OOMPolicy, OOMScoreAdjust and the ManagedOOM* properties to systemd1 KNOWN_UNIT_SIGNATURES
  • Fix Unit.SetProperties raising NotImplementedError: it now encodes properties like Manager.SetUnitProperties does, and takes a dict or a list of (name, value) pairs (#122)
  • Add CPUWeight, IOWeight, AllowedCPUs, MemoryMin, the IO*Max limits and other cgroup properties to systemd1 KNOWN_UNIT_SIGNATURES
  • Split pystemd.utils into a package (pystemd.utils.{x2,unit,typing}); existing imports keep working
  • Add pystemd.utils.ns.join_namespaces (atomic pidfd setns, with a per-namespace fallback)
  • Fix pystemd.futures workers leaking one fd per namespace, and silently running outside the unit's namespaces when one can't be joined: they now use pystemd.utils.ns.join_namespaces
  • Fix crashes in pystemd.dbuslib: DbusMessage.get_path() / get_member() / ... segfaulting on a header field the message lacks (they now return None), get_interface() returning the path, DBus.close() twice aborting and using a closed bus corrupting memory (it now raises), and DBusMachine / DBusRemote keeping a dangling pointer to their name (they now also take str)
  • Fix DBus.match_signal not keeping its callback alive and failing for bound methods; the callback no longer gets a metadata attribute
  • DBus buses are now freed when garbage collected; sd-bus errors while building a message, and unbalanced ( in signatures, now raise instead of being ignored
  • Update the Unit type stubs to systemd 259's Unit and Service interfaces, and ship py.typed so type checkers use them (#71)
  • Document the file descriptor store, delegate=, Unit.SetProperties and join_namespaces, and add examples/fdstore_counter.py
  • Fix leaked D-Bus messages, errors and passed file descriptors when DBus.call_method or DBus.get_property fails
  • Fix Manager.StartTransientUnit, Manager.SetUnitProperties and Unit.SetProperties called on the object (manager.StartTransientUnit(...), not manager.Manager.StartTransientUnit(...)) shifting their arguments and failing with an AssertionError (#120)
  • Add DeviceAllow to systemd1 KNOWN_UNIT_SIGNATURES (#119); an unknown unit property now raises a KeyError that says how to add its signature
  • Ship a PyInstaller hook, so apps frozen with PyInstaller work without adding pystemd's modules to hiddenimports (#90)
  • Document how to start, stop, restart, enable, disable and mask units (the systemctl equivalents), and add examples/manage_units.py
pip install pystemd==0.16.0