nself-plugin
Python plugin authoring SDK for nSelf. Parity with plugin-sdk-go v0.1.0.
Install
pip install nself-plugin
For database migrations:
pip install 'nself-plugin[db]'
Quick start
from nself_plugin import Plugin, PluginContext, HealthStatus
plugin = Plugin(name="my-notify", version="1.0.0")
@plugin.install
async def install(ctx: PluginContext) -> None:
ctx.env.require(["SMTP_HOST", "SMTP_PORT"])
@plugin.start
async def start(ctx: PluginContext) -> None:
app = ctx.http.create_app()
app.post("/notify/send")(handler)
await ctx.http.listen(ctx.port)
@plugin.health
async def health(ctx: PluginContext) -> HealthStatus:
return await ctx.http.ping("/notify/healthz")
Scaffold a plugin
nself plugin new my-plugin --lang python
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nself_plugin_sdk-1.2.6.tar.gz
(10.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nself_plugin_sdk-1.2.6.tar.gz.
File metadata
- Download URL: nself_plugin_sdk-1.2.6.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19c06d2751fdf12463d6c8573d2df32945a6df41c776c45a607310ac209b53cf
|
|
| MD5 |
3ff09b2f929b42ba2e7d4c7726ca0ca4
|
|
| BLAKE2b-256 |
69b515a316fc3e04d122c19e4b7d6e406a16e7238da675d1ed889b837d15a398
|
File details
Details for the file nself_plugin_sdk-1.2.6-py3-none-any.whl.
File metadata
- Download URL: nself_plugin_sdk-1.2.6-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8f5e0a53fe3f558d5f5efb8fd2c2eb2115c9465fee65c17a15d1de17c025485
|
|
| MD5 |
03afe5355f98278a98bd7f54008e763f
|
|
| BLAKE2b-256 |
31c939f2a7f445a462e341dbc15a7432d05702cf89119544ca09e8a174ee0ac0
|