Skip to content

Commit

Permalink
Merge pull request #1 from stigok/release-0.1.0
Browse files Browse the repository at this point in the history
Release 0.1.0
  • Loading branch information
stigok committed Jan 30, 2020
2 parents 3621bfb + cef51cc commit 78fddcb
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.PHONY: build clean upload-test

build: clean
python3 setup.py sdist bdist_wheel

clean:
rm -rf build dist *.egg-info __pycache__

upload-test:
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ Simple sd_notify(3) client functionality implemented in Python 3.

Usage:
```
notify = Notifier()
import sd_notify
notify = sd_notify.Notifier()
if not notify.enabled():
# Then it's probably not running is systemd with watchdog enabled
raise Exception("Watchdog not enabled")
notify.status("Starting things up...")
# Report a status message
notify.status("Initialising my service...")
time.sleep(3)
notify.ready() # Init complete
notify.status("Waiting for requests...")
# Report that the program init is complete
notify.ready()
notify.status("Waiting for web requests...")
time.sleep(3)
notify.notify_error("Making the program quit with error!")
# systemd will kill the program here
# Report an error to the service manager
notify.notify_error("An irrecoverable error occured!")
# The service manager will probably kill the program here
time.sleep(3)
```

Expand Down
26 changes: 16 additions & 10 deletions sd_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@
Usage:
```
notify = Notifier()
import sd_notify
notify = sd_notify.Notifier()
if not notify.enabled():
raise Exception("Watchdog not enabled")
# Then it's probably not running is systemd with watchdog enabled
raise Exception("Watchdog not enabled")
notify.status("Starting things up...")
time.sleep(3)
# Report a status message
notify.status("Initialising my service...")
time.sleep(3)
notify.ready() # Init complete
notify.status("Waiting for requests...")
time.sleep(3)
# Report that the program init is complete
notify.ready()
notify.status("Waiting for web requests...")
time.sleep(3)
notify.notify_error("Making the program quit with error!")
# systemd will kill the program here
time.sleep(3)
# Report an error to the service manager
notify.notify_error("An irrecoverable error occured!")
# The service manager will probably kill the program here
time.sleep(3)
```
Author: [email protected] Dec 2019
Expand Down
28 changes: 28 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from setuptools import setup, find_packages

def readme():
with open('README.md') as f:
return f.read()

setup(
name="sd-notify",
version="0.1.0",
py_modules=["sd_notify"],
author="stigok",
author_email="[email protected]",
description="Simple sd_notify client library for Python 3",
long_description=readme(),
long_description_content_type="text/markdown",
keywords="sd-notify systemd python3 watchdog",
url="http://github.com/stigok/sd-notify/",
project_urls={
"Bug Tracker": "http://github.com/stigok/sd-notify/issues",
"Documentation": "http://github.com/stigok/sd-notify/",
"Source Code": "http://github.com/stigok/sd-notify/",
},
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
],
python_requires=">=3.5",
)

0 comments on commit 78fddcb

Please sign in to comment.