Skip to main content

pysysdc Travis Build Status Github Actions Status

Python3.5+ sd-bus adapter which allows to manage services, publish and call methods, natively control systemd units.

Tested on Ubuntu 16.04 and Ubuntu 20.04.

Idea

If you are orchestrating a large number of services on a Linux system, you have to run the command service or systemctl quite frequently. If you want to do this programmatically, you have to start the process in most cases with a shell (to parse systemctl commands arguments) which sometimes may lead you to arguments symbols escaping.

What will do the systemctl restart nginx.service command in the end? This command will send message over SD-Bus to systemd daemon (PID 1) which will restart nginx service. What if it is possible to send the message to systemd through the SD-Bus directly from Python? What if the same mechanism can be used for IPC?

How to compile

sudo apt update
sudo apt install python3-setuptools python3-stdeb python3-all-dev libsystemd-dev dh-python
python3 ./setup.py build

How to build DEB package

Just run build.sh and make sure you installed fakeroot package.

sudo apt update
sudo apt install fakeroot python3-setuptools python3-stdeb python3-all-dev libsystemd-dev
./build.sh

How to use

For example you can reload nginx service in the following way:

import pysysdc.systemctl as systemctl

systemctl(svc="nginx", action="reload")

All supported unit methods can be found here.

It's also possible to set your hostname through this library without any subprocess spawn, configuration editing and etc:

from pysysdc.methods import Methods

Methods.set_pretty_hostname("myhostname")

or reboot your machine

from pysysdc.methods import Methods

Methods.machine_reboot()

see other implemented systemd methods here.

Also you can publish method in you service.

from pysysdc.sdbus import SDServer

token_data = "Zm9yaDhhOWViZWJjMjYxZmU1MTVlOTlhNjczMWE3NWQ3N2ZiOjoyMDQ3NzY6Omh0dHA6Ly9yZWdpb25zZWZmZWN0aXZlLmNvbS86Ojo6MTUxMDczMjE6OjY2NDcxNDo6MDo6MTo6MTo6OjowOjpkZWZhdWx0Ojow"
def token(arg: str) -> tuple:
	print("Hello from handler token().")
	print("Function runned with argument: '%s'." % arg)
	return True, token_data

def config(mode: str, data: str) -> tuple:
	print("Hello from handler config().")
	print("Mode: '%s'" % mode)
	print("Data: '%s'" % data)
	return True, 'done', 'test', 10

sd = SDServer(
	(
		{"path": "/dc/cloud/auth", 
		"if_name": "dc.cloud.auth", 
		"method_name": "Token", 
		"input_sig": "s", 
		"output_sig": "is", 
		"method_handler": token},

		{"path": "/dc/cloud/auth",
		"if_name": "dc.cloud.auth.config", 
		"method_name": "Config", 
		"input_sig": "ss", 
		"output_sig": "issi", 
		"method_handler": config},
	)

)
sd.listen() # blocking

and call it from another program

from pysysdc.sdbus import SDClient

sd = SDClient(
	service_name="dc.cloud.auth",
	path="/dc/cloud/auth",
	if_name="dc.cloud.auth",
	method_name="Token",
	input_sig="s",
	output_sig="is"
)
ret = sd.send(method_name="Token", first_arg="get")
print(ret)
print(repr(ret))

Metadata

Release files for pysysdc 2.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysysdc 2.0.8
File Size Uploaded
pysysdc-2.0.8.tar.gz 24.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pysysdc 2.0.8
File
pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl PyPy 3.9 PyPy 3.9 7.3 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_i686.whl PyPy 3.9 PyPy 3.9 7.3 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl PyPy 3.8 PyPy 3.8 7.3 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_i686.whl PyPy 3.8 PyPy 3.8 7.3 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_i686.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp311-cp311-manylinux_2_24_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp311-cp311-manylinux_2_24_i686.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp310-cp310-manylinux_2_24_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp310-cp310-manylinux_2_24_i686.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp39-cp39-manylinux_2_24_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp39-cp39-manylinux_2_24_i686.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp38-cp38-manylinux_2_24_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp38-cp38-manylinux_2_24_i686.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_i686.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-32 Details
pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64 Details
pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-32 Details

Total release size: 21.1 MB

Release files / pysysdc-2.0.8.tar.gz

Download URL pysysdc-2.0.8.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8d2e5e9690ea36e3752143ed90764e6786972e9bd19f3f4d2df31792d202713d
BLAKE2b-256 checksum
How to use checksums
11b629c07252092a1ec450911bf5890af28b1432f9f8d8c7732e9005d0626cf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-64 PyPy 3.9 PyPy 3.9 7.3
SHA-256 checksum
How to use checksums
73b901e3163e187d2880661d6b7b7a76a11e7d4d59497aeae4f1f51eb51992f7
BLAKE2b-256 checksum
How to use checksums
72a768e23805b6c6ab1b9ed85c39ba9e7d94fefbc644c0c5b53938818e849497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-pp39-pypy39_pp73-manylinux_2_24_i686.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-32 PyPy 3.9 PyPy 3.9 7.3
SHA-256 checksum
How to use checksums
be8985ff2bd96bf2c6aab249be925dc16a4868050d226c85cdbf0ea2d3e9ccb2
BLAKE2b-256 checksum
How to use checksums
cd7d83fc29b7a1ed02d4b4207fc0deeb495fcb0149aed89edb30a8b5528950bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-64 PyPy 3.8 PyPy 3.8 7.3
SHA-256 checksum
How to use checksums
bf6e046d051cbd48b5f92b8acf01a44f40f792485bb52c5631d669ffce4e0bf1
BLAKE2b-256 checksum
How to use checksums
908274c674687647586329c9e5a7014632fb0ab94b17375a5685d6f6bbe601de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-pp38-pypy38_pp73-manylinux_2_24_i686.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-32 PyPy 3.8 PyPy 3.8 7.3
SHA-256 checksum
How to use checksums
8edff0d0b2eed0e53bc364b778adff855e8a0582533cf32ca072f300b57ade1a
BLAKE2b-256 checksum
How to use checksums
56a53ed907837c3f0ff9c59d8f9188590bd24e95821b717a06e1086bdd1bd3ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
916a84ebabaece4897c83beb8a80a3427810a59beb988379c6c0c7119fee0749
BLAKE2b-256 checksum
How to use checksums
b3082a7ff0092b8693df841a5c3f2b3138b94cdb1d157c08dac8e229d89091a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-pp37-pypy37_pp73-manylinux_2_24_i686.whl
Size 1.1 MB
Tags Linux glibc 2.24+ x86-32 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
19acd799db9478fa1bae04c33c2a9aff0dd8b24b8b4bf7448a4d2148b6349c87
BLAKE2b-256 checksum
How to use checksums
abc49eb11332d32671e4406d6740e08ff6445d79ebe56f02a9cab4e1d90eaff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp311-cp311-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp311-cp311-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
22c7c24950ae371b1d6cbcadbe451dc149870ee6e3b0a0029cc77ba663fdd6c7
BLAKE2b-256 checksum
How to use checksums
1f7bea9efef5c16896af673f91f4870cbd50368985d874ce2d7a8593721f0133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp311-cp311-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp311-cp311-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
fa6158ef6c99cd00e6feec70318a32df1a387a7134efba1bce04d68a988f872e
BLAKE2b-256 checksum
How to use checksums
6444702503bee22e03512cc10a7f5cc8e14bdbf0addb2b72d3a29025825dee45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp310-cp310-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp310-cp310-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
e2fbbda5c38cd283145ccce15ed849f693c68d0548b47800afa327d8ae1d882d
BLAKE2b-256 checksum
How to use checksums
b21845c2607f1a8fa3b9a046c93c649dfebebb97f9e91188ce4278b064396951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp310-cp310-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp310-cp310-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
9e77bdd324fb22eac7ac6767e6999a07b45aa39c352a87b517fad4108e3ab63a
BLAKE2b-256 checksum
How to use checksums
7c6b16a6ba29f7cf06abb6525104fbfe21655a4b73ede26356c83e6ef23edc60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp39-cp39-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp39-cp39-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
3d8954b781c4f6e7034644fdcb2494217c4575978d61b0442fb6afe82af63b6f
BLAKE2b-256 checksum
How to use checksums
6ad4d3aec45981cd278d28b6fd12a3029c66bf68bb81636a50a43202deb88388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp39-cp39-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp39-cp39-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
66331c23b75b416469d92ab1bc135cc097ea3e2305f21dbe2305dcdf89f13e74
BLAKE2b-256 checksum
How to use checksums
8ecb037031853a85ebac5396814306fa589af62441da06a169bd253d25d14710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp38-cp38-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp38-cp38-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
5b0844e6518150bbf2cfc5fc7809e49e7ce079e23e10aa77f8dc2d0e29908104
BLAKE2b-256 checksum
How to use checksums
146eae02a9086a1738d08ee501946c5933518cd096ed8f178d9a4e2d09e64f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp38-cp38-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp38-cp38-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
e5dad2a6cf03c98d59c2eb4f4f795c2ba07e5912f54280250e3a86f9d0afc03c
BLAKE2b-256 checksum
How to use checksums
04d3a4a29795928d17f0c1ff606052f742ded437268fb870230e0847daa7e740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
4a215c38190031d3024c27c84c2163301ff52afc04a8312de44c52d84dba4a72
BLAKE2b-256 checksum
How to use checksums
d21a22304035fe386c317e5c4f8c1fe4f2cbc0c38dbbbd87346e5162da487588
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp37-cp37m-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
7ed07f8db1ab03321ad26c2fe9a86c6426552b4afa5077ba3ed0592267cf5e05
BLAKE2b-256 checksum
How to use checksums
6f572c2ff5e020045e0231c156450dc76de8f078d796cc3a19817662796d0453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_x86_64.whl

Download URL pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_x86_64.whl
Size 1.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
87261e23c78eaa74ff53ed09667cdb451c6dc0859de3dde67d2d05cf0427d156
BLAKE2b-256 checksum
How to use checksums
47d74beec91170d48bab3010bb65d60822ec65bd99a39971e0ed632a65149c04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_i686.whl

Download URL pysysdc-2.0.8-cp36-cp36m-manylinux_2_24_i686.whl
Size 1.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-32
SHA-256 checksum
How to use checksums
3cdbe2671f9b7138d0b76410e6c81bd1c1bec8ac764e746d2c9977c708c1b297
BLAKE2b-256 checksum
How to use checksums
0f65c05245eb7c93fbe4c9bc44a920a79c404e4bfe8d4cb470c2e2427378a965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

2.0.8 This release

19 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page