trick17
trick17 is a pure python, lightweight package that interfaces with various systemd components.
Table of Contents
Installation
pip install trick17
Modules
trick17.daemon
daemon.booted()returnsTrueif system was booted by systemd.daemon.notify(state)sends a notification to systemd.listen_fds()returns an list of (fd, name) tuples in case of socket activation, see systemd.socket
trick17.journal
The trick17.journal allows to use the systemd Native Journal Protocol via the Python Logging facility.
JournalHandleris alogging.Handlersubclass that speaks the systemd Native Journal Protocol- Function
stderr_is_journal()can be used to check if logging viasys.stderrshould be upgraded to native logging, see Automatic Protocol Upgrading
import logging
from trick17 import journal
if journal.stderr_is_journal():
handler = journal.JournalHandler()
else:
handler = logging.StreamHandler()
root = logging.getLogger()
root.addHandler(handler)
logging.error('Something happened')
License
trick17 is distributed under the terms of the MIT license.
Motivation and alternatives
Many existing interfaces to systemd are python bindings to libsystemd, see e.g. python-systemd or cysystemd. Even if most systems running under systemd will have libsystemd already installed, a native python implementation has many advantages:
- easy vendoring,
- pypi availability of no-ABI, platform independent wheels, with no transitive dependencies.
This package is a partial implementation of the most used (at least by me) functions of libsystemd. Please feel free open a issue if this package is useful to you and misses a feature.
Metadata
Release files for trick17 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trick17-0.0.4.tar.gz | 9.1 kB | Without provenance | Details for trick17-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trick17-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for trick17-0.0.4-py3-none-any.whl |
Total release size: 16.9 kB
Release files / trick17-0.0.4.tar.gz
| Download URL | trick17-0.0.4.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ff6c139ea8cc4729bb2ffa4b65bf0f393edd7b8453746b5e948e32bd073b8c9
|
|
BLAKE2b-256 checksum How to use checksums |
b82efa685f2ebb6f39c84b6d8dd7c443073d2a2e365654fb6feea06d3f241453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Release files / trick17-0.0.4-py3-none-any.whl
| Download URL | trick17-0.0.4-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a089857b7de90d32d77f6c2b67678280ea37d319d9c92f74fa34b90593318d3e
|
|
BLAKE2b-256 checksum How to use checksums |
ae6feeee0dabe91a7de6436310c9fd7a718ff751b60250facd7b2a16511c1af6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.5
|
Security for trick17 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.