Skip to content

Commit c65a181

Browse files
committed
✨ feat: useNotify
1 parent 69b35f3 commit c65a181

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

example/use_notify.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from usepy import useNotify, useNotifyChannels
2+
3+
notify = useNotify()
4+
notify.add(
5+
useNotifyChannels.Bark({"token": "jtgTe64kJAtq4iyj6DaepQ"}),
6+
)
7+
8+
notify.publish(content="usepy")

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "usepy"
3-
version = "0.1.34"
3+
version = "0.1.35"
44
description = "usepy"
55
homepage = "https://usepy.code05.com/"
66
authors = ["miclon <jcnd@163.com>"]
@@ -24,6 +24,12 @@ uvicorn = "^0.20.0"
2424
[tool.poetry.group.dev.dependencies]
2525
black = "^23.1.0"
2626

27+
[tool.poetry.extras]
28+
notify = ["usepy-plugin-notify"]
29+
30+
[tool.poetry.group.notify.dependencies]
31+
usepy-plugin-notify = "^0.2.2"
32+
2733
[build-system]
2834
requires = ["poetry-core"]
2935
build-backend = "poetry.core.masonry.api"

src/usepy/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
)
4949
from .utils.bloom_filter import BloomFilter as useBloomFilter
5050

51+
try:
52+
from notify import useNotify, channels as useNotifyChannels
53+
except ImportError:
54+
raise ModuleNotFoundError(
55+
"You need install the 'usepy_plugin_notify' module before use 'useNotify'"
56+
)
57+
5158
__all__ = [
5259
# data
5360
'useDict',
@@ -89,4 +96,8 @@
8996
'useDateTime',
9097
'usePath',
9198
'useThread',
99+
100+
# plugins
101+
'useNotify',
102+
'useNotifyChannels',
92103
]

0 commit comments

Comments
 (0)