Skip to main content

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.3.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nself_plugin_sdk-1.3.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file nself_plugin_sdk-1.3.3.tar.gz.

File metadata

  • Download URL: nself_plugin_sdk-1.3.3.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

Hashes for nself_plugin_sdk-1.3.3.tar.gz
Algorithm Hash digest
SHA256 11924b525cc3c2dbccdd836fabdd972e6f2c12a34258353d9adeac5202ddf182
MD5 3430d1830e560b37b71d064740f88be5
BLAKE2b-256 0820dc7bf0e368fae35a5820d16d7c3c26c93a688d0582e85adac3028c62e5b6

See more details on using hashes here.

File details

Details for the file nself_plugin_sdk-1.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nself_plugin_sdk-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cff285301e55d4f55a8793675f376419e4cff7b59cb8e2bf899c6b2178692b86
MD5 f5571b56d1020714fc8882fdba9c97de
BLAKE2b-256 8efb225f97f5cc2538fefbe5e91679b946577063f324caa2f7a71434c757b33a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.5

2 files

1.3.4

2 files

This release

1.3.3 This release

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page