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.3.0.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.3.0.tar.gz.
File metadata
- Download URL: nself_plugin_sdk-1.3.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07e6d574cd59803fc7450c326a6f2f4d77bb01ce5632a0c4655800d63de473f5
|
|
| MD5 |
e7fa6182b8d377142cf70dc24f890d6a
|
|
| BLAKE2b-256 |
bd68acb5efe7c612eb9db656facb64771d12e9bf675de1e5f8e3c5e4511832c2
|
File details
Details for the file nself_plugin_sdk-1.3.0-py3-none-any.whl.
File metadata
- Download URL: nself_plugin_sdk-1.3.0-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.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c80442413267c8ad71fd32db4cb3609f20d11ebbbcf6d1b691f7eea7ed3aa78
|
|
| MD5 |
aefb40983fe41ddc457f523703633a90
|
|
| BLAKE2b-256 |
8003131ce8b2b8a9f1780883ad176b7178f63a63c38e6f14386fe1f58e6a9f27
|