Skip to content

Commit 78fddcb

Browse files
authored
Merge pull request #1 from stigok/release-0.1.0
Release 0.1.0
2 parents 3621bfb + cef51cc commit 78fddcb

File tree

5 files changed

+67
-16
lines changed

5 files changed

+67
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
venv

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: build clean upload-test
2+
3+
build: clean
4+
python3 setup.py sdist bdist_wheel
5+
6+
clean:
7+
rm -rf build dist *.egg-info __pycache__
8+
9+
upload-test:
10+
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ Simple sd_notify(3) client functionality implemented in Python 3.
44

55
Usage:
66
```
7-
notify = Notifier()
7+
import sd_notify
8+
9+
notify = sd_notify.Notifier()
810
if not notify.enabled():
11+
# Then it's probably not running is systemd with watchdog enabled
912
raise Exception("Watchdog not enabled")
1013
11-
notify.status("Starting things up...")
14+
# Report a status message
15+
notify.status("Initialising my service...")
1216
time.sleep(3)
1317
14-
notify.ready() # Init complete
15-
notify.status("Waiting for requests...")
18+
# Report that the program init is complete
19+
notify.ready()
20+
notify.status("Waiting for web requests...")
1621
time.sleep(3)
1722
18-
notify.notify_error("Making the program quit with error!")
19-
# systemd will kill the program here
23+
# Report an error to the service manager
24+
notify.notify_error("An irrecoverable error occured!")
25+
# The service manager will probably kill the program here
2026
time.sleep(3)
2127
```
2228

sd_notify.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@
33
44
Usage:
55
```
6-
notify = Notifier()
6+
import sd_notify
7+
8+
notify = sd_notify.Notifier()
79
if not notify.enabled():
8-
raise Exception("Watchdog not enabled")
10+
# Then it's probably not running is systemd with watchdog enabled
11+
raise Exception("Watchdog not enabled")
912
10-
notify.status("Starting things up...")
11-
time.sleep(3)
13+
# Report a status message
14+
notify.status("Initialising my service...")
15+
time.sleep(3)
1216
13-
notify.ready() # Init complete
14-
notify.status("Waiting for requests...")
15-
time.sleep(3)
17+
# Report that the program init is complete
18+
notify.ready()
19+
notify.status("Waiting for web requests...")
20+
time.sleep(3)
1621
17-
notify.notify_error("Making the program quit with error!")
18-
# systemd will kill the program here
19-
time.sleep(3)
22+
# Report an error to the service manager
23+
notify.notify_error("An irrecoverable error occured!")
24+
# The service manager will probably kill the program here
25+
time.sleep(3)
2026
```
2127
2228
Author: stig@stigok.com Dec 2019

setup.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from setuptools import setup, find_packages
2+
3+
def readme():
4+
with open('README.md') as f:
5+
return f.read()
6+
7+
setup(
8+
name="sd-notify",
9+
version="0.1.0",
10+
py_modules=["sd_notify"],
11+
author="stigok",
12+
author_email="stig@stigok.com",
13+
description="Simple sd_notify client library for Python 3",
14+
long_description=readme(),
15+
long_description_content_type="text/markdown",
16+
keywords="sd-notify systemd python3 watchdog",
17+
url="http://github.com/stigok/sd-notify/",
18+
project_urls={
19+
"Bug Tracker": "http://github.com/stigok/sd-notify/issues",
20+
"Documentation": "http://github.com/stigok/sd-notify/",
21+
"Source Code": "http://github.com/stigok/sd-notify/",
22+
},
23+
classifiers=[
24+
"License :: OSI Approved :: MIT License",
25+
"Programming Language :: Python :: 3 :: Only",
26+
],
27+
python_requires=">=3.5",
28+
)

0 commit comments

Comments
 (0)