Skip to content

allisonkarlitskaya/systemd_ctypes

Folders and files

NameName
Last commit message
Last commit date
Jun 7, 2024
Feb 14, 2023
Feb 2, 2024
Feb 2, 2024
Feb 14, 2023
Jul 1, 2022
Jun 6, 2022
Feb 14, 2023
Jun 22, 2023

Repository files navigation

systemd_ctypes

A small pure-ctypes wrapper around libsystemd.

This depends on at least libsystemd 239, which was released on 2018-06-22.

This project aims to build a small wrapper around libsystemd based on ctypes, using semi-automated binding techniques. The highlevel goals are:

  • easy to embed in other projects (eg: in zipapp packages)
  • small code size with little binding-related boilerplate: in many cases, one line per bound function
  • reasonable performance, but not at the cost of readability
  • seemless integration of systemd's event loop with asyncio, including async/await.

The initial focus is on the sd_event and sd_bus APIs.

There's a higher-level PathWatch API to make it easier to use inotify.

Check the examples and tests for how to use systemd_ctypes.

This project originated as a weekend hack to support the efforts to write a portable Python version of cockpit-bridge.

Run tests with pytest or tox.