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.4.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.4.tar.gz.
File metadata
- Download URL: nself_plugin_sdk-1.3.4.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 |
1037e9e25e9d3b366facd501bfdead3bd702cde38756cfede351a2d0b5a4db3d
|
|
| MD5 |
c07e1ef36c1c84bcb982b9db5594d739
|
|
| BLAKE2b-256 |
6a48e431693a70be060b06dee0d6ddadbc286266e372feb68431e0452c103f43
|
File details
Details for the file nself_plugin_sdk-1.3.4-py3-none-any.whl.
File metadata
- Download URL: nself_plugin_sdk-1.3.4-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 |
3058d3a611ed7e8251d62a7e4f9119d1cebc82eb3d4c25c490f776fa207bcc3d
|
|
| MD5 |
97fb440bea34b53403d6f2a3ddb2bbcc
|
|
| BLAKE2b-256 |
660ab8e9c7b7dbc60b2562e641e6f24e2eb8c67107d183f259d34b4a0a669da0
|