Skip to main content

Python plugin authoring SDK for nSelf. Parity with the Go SDK at github.com/nself-org/cli/sdk/go.

Project description

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

Project details


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.5.tar.gz (10.3 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.2.5-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nself_plugin_sdk-1.2.5.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for nself_plugin_sdk-1.2.5.tar.gz
Algorithm Hash digest
SHA256 890c2a478f97b26213123ecd65f5e1461b919f29e8629d580ab84eca49a71095
MD5 79addba015b96d91720533607c5a4e72
BLAKE2b-256 5d5cbc326d373c2f1abd935c1bd64bc595e60acbf031f23d5064d68907874848

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nself_plugin_sdk-1.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f34a8b91e3843c98bb52c956f25285ab803ab77a1bf85e1a855465ff384dd4e9
MD5 2d3e6ef1cadb14f12d39e140d1130040
BLAKE2b-256 311072d701ac503af50537b6576bd337a43f960d54fa35d2149d02a20a4ae90a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page