Python bindings for sd-bus
Project description
pysysdc
Python3.5+ sd-bus adapter which allows to manage services, publish and call methods.
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
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:
from pysysdc.unit import Unit
Unit("nginx").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 SDBus
data = "example data string"
def handler():
return True, data
sd = SDBus(path="/dc/cloud/auth", if_name="dc.cloud.auth", method_name="Token", method_args="s", output_sig="s", method_return="s")
sd.set_func(handler)
sd.listen()
and call it from another program
from pysysdc.sdbus import SDBus
sd = SDBus(
path="/dc/cloud/auth",
if_name="dc.cloud.auth",
method_name="Token",
method_args="s",
method_return="s",
output_sig="s")
ret = sd.send(method_name="Token")
print(ret)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pysysdc-1.0.0.tar.gz
.
File metadata
- Download URL: pysysdc-1.0.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5700b5a2247e69d162131cfb47225a8b2eb7b844fceab1d2e4faae4950933276 |
|
MD5 | c9915155a6a12ffb46137cf23de486a5 |
|
BLAKE2b-256 | 6259165d0ff47a2255bca150e45b26c62e6131b897a07866d793259b69743ecc |
File details
Details for the file pysysdc-1.0.0-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp39-pypy39_pp73-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc6ee6cbadbd4cd4b9e48a335583d79221dfae309059f5105c5a4162362cb6cc |
|
MD5 | fae5843695b3bbd0a5fb5de2dadc7968 |
|
BLAKE2b-256 | 5436656adddfe7583526112c327a2919300dc21353b5606ec7dba28ee4c630ee |
File details
Details for the file pysysdc-1.0.0-pp39-pypy39_pp73-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp39-pypy39_pp73-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64f6e0543b2fd05e08b1cd7e9da4e58c8f4b3ee83cbfe609c93b9e3d65cfb961 |
|
MD5 | 0b1038319dbe9a658b8b0576cf6f9af2 |
|
BLAKE2b-256 | 29b9d634ddf599c4660d5c0973d0fb551a30cbba30737c38d1e34d9df8802f61 |
File details
Details for the file pysysdc-1.0.0-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72d8b0f1627ab171b0c442f8b2edb888d0e93ccb1d17ae1a45ea650d19f878d0 |
|
MD5 | 9bb62db319ba850cc929aafb7581660c |
|
BLAKE2b-256 | 1bddfe9a5852701c256316f142531834871d69c38f7043f0c8e6a3831b78b8f6 |
File details
Details for the file pysysdc-1.0.0-pp38-pypy38_pp73-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp38-pypy38_pp73-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bfdad45eb8cf246da9fcd957e9ca90fbe8b920cf2a6be6b33f48f9b2ff63cd0 |
|
MD5 | 54c4276eb01c576403b4175a646fa298 |
|
BLAKE2b-256 | 17ad5d5fc9f785bf4b90239db9dc4812468c1c6649162f9b3038e9fc99a78b93 |
File details
Details for the file pysysdc-1.0.0-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d06ff94403b7504196bb6e761108acae53f565b6fcdeb62b63936e73c7c5fddb |
|
MD5 | f177e539d81387e124195b81cae1c2aa |
|
BLAKE2b-256 | 6988768ea8a222abae7144b22c550ed5c45323460fb5f2fc0f0e8458ed2ee699 |
File details
Details for the file pysysdc-1.0.0-pp37-pypy37_pp73-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-pp37-pypy37_pp73-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.1 MB
- Tags: PyPy, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eea54b6ea3776c6a14d553d1a27ab0cb2365e58cbe51e467cd4d767d18e800b |
|
MD5 | fa5040413532a69fba4e3df70e2a2881 |
|
BLAKE2b-256 | e7de5573800617195a7e8613c867f673152431229764a14688137037bab536cc |
File details
Details for the file pysysdc-1.0.0-cp311-cp311-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp311-cp311-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5266bffafa020ddfa1f0d2c0bea20c25a39430676572238e6e280aaa8ae631b2 |
|
MD5 | 05975bcbf5698f6b1816ffdb9063bd8c |
|
BLAKE2b-256 | 40570f1df8f5de8897436bb6d5b01d60e79e04074ed6b47476410050f47d4876 |
File details
Details for the file pysysdc-1.0.0-cp311-cp311-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp311-cp311-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a60e3c8a64ec4ffe729d31393369e94e08d2708fe4e8691937db72afb2a68e |
|
MD5 | 5b2d4693e7c52571cf935986e93a0c80 |
|
BLAKE2b-256 | 079caa10c3f7dee157708be19415d650a80ae28b7e6172ba4380f4ee8c003354 |
File details
Details for the file pysysdc-1.0.0-cp310-cp310-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp310-cp310-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df028385a2afd9b46c0f269b75c15c2caa449bf3e05ba4c7002bfb29e04efc7 |
|
MD5 | aabf4ecdc87ceaaded6245ba0d0b9c08 |
|
BLAKE2b-256 | 312c1efb482a1ca3f1e7aae09591f23f8c16cdd3cd6853a602b18cd3d9efca17 |
File details
Details for the file pysysdc-1.0.0-cp310-cp310-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp310-cp310-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89d04f47b03ff2b33f2ee151e33f968b9dcd2cdfce8c35b4a57514a455b1da2c |
|
MD5 | 5c58b4252b6fb81bc84e1624e50c502e |
|
BLAKE2b-256 | 1fe4ba1e3afb214fec3958b08684e00cec6b6689c9dc8327b52038f99ba4935b |
File details
Details for the file pysysdc-1.0.0-cp39-cp39-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp39-cp39-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba49f8cfc103ae987614c110fa0aaf30ed9c07efb2117d416a76eaccf51f04b4 |
|
MD5 | a6631b76864c3454b4cdedbeaf889eec |
|
BLAKE2b-256 | 5c3050fab9706f5cb237a3c98dec0d609fc1692319301a1f88c513dc80611a17 |
File details
Details for the file pysysdc-1.0.0-cp39-cp39-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp39-cp39-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca44ce44d664be7847dc1c8d0a9065c29524b69020d26dd694e5fc40d5cfadcf |
|
MD5 | 5c73cac7d52a7e68bea1cdf1fac1e6e6 |
|
BLAKE2b-256 | f5d8ad3554508bfd2614451023e98cd5ab405669792dc01e75ece04c1769daae |
File details
Details for the file pysysdc-1.0.0-cp38-cp38-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp38-cp38-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c051d96cd1b819001730e7f69f25e9849f5264021f2de5e2df8d6045a0e1e7cf |
|
MD5 | 54c83f48d570790013114ebcc175f6b2 |
|
BLAKE2b-256 | 8df15b20fe9b6f3d2ce8b8d12675a25c9b7e57a8024b79c638097386684feba5 |
File details
Details for the file pysysdc-1.0.0-cp38-cp38-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp38-cp38-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.8, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01d08a408e3390d74f6fcaba65a86518917cd9a96f8378dedc83b3b48797a16b |
|
MD5 | 6e175dbae1a5df8843b20137171d4d63 |
|
BLAKE2b-256 | 0bb41ad32cc8096bea8f217de1376cb987424fdeffe274d605443d4c1c3c533e |
File details
Details for the file pysysdc-1.0.0-cp37-cp37m-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp37-cp37m-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7m, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 664a83eeea6cf38d7458815b997798318afa7192051b427479886462b7814637 |
|
MD5 | a3fd8834dea450c62c9de348cff3a1e7 |
|
BLAKE2b-256 | 525c12d6109d473730aa90540508dc12a620a5908442dbba1962be5bf167607b |
File details
Details for the file pysysdc-1.0.0-cp37-cp37m-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp37-cp37m-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.7m, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3692291635f9b3d3c8fd1b9d8622101b05023aa5adbf0826271e135627a3726c |
|
MD5 | f1557d22f7f586e18e6df5b021bee3d8 |
|
BLAKE2b-256 | 35f36c03cf549f48fd79afc7741c9fa1ebbe513e11dbea4b5f7f285be4382c41 |
File details
Details for the file pysysdc-1.0.0-cp36-cp36m-manylinux_2_24_x86_64.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp36-cp36m-manylinux_2_24_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.6m, manylinux: glibc 2.24+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6edc3c2ec908cd94821cf4f6089e4f194c8a975b927e74ee629228676d586378 |
|
MD5 | 4807ec3e2e8e46b9c5bdf11978db9638 |
|
BLAKE2b-256 | 25ae039c7a9996463b9e9b3571a5e854ffc7222e36ae450b25b708f4463bc1f6 |
File details
Details for the file pysysdc-1.0.0-cp36-cp36m-manylinux_2_24_i686.whl
.
File metadata
- Download URL: pysysdc-1.0.0-cp36-cp36m-manylinux_2_24_i686.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.6m, manylinux: glibc 2.24+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5299efa9b6b14e1d4cf3ae9e347f2c698d0f72d676882cf48030fb3fd2778f6a |
|
MD5 | f068598bba4987f77b94b7ade755125a |
|
BLAKE2b-256 | 26175d7d9c3a789fc7ed10fa3eb249877ca2a320a44abaa68638f85ceefdf389 |