Skip to main content

Official Python SDK for building plugins for the Eyeriss API Gateway. Provides the base class, hook types, and data structures for Python and WASM plugin development.

Project description

Eyeriss Plugin SDK

Official Python SDK for building plugins for the Eyeriss API Gateway.

Installation

pip install eyeriss-plugin-sdk

Quick Start

Create a plugin directory with manifest.json, plugin.py, and eyeriss.sig:

from eyeriss_plugin_sdk import EyerissPlugin
from eyeriss_plugin_sdk.types import PluginContext, PluginResult

class Plugin(EyerissPlugin):
    @property
    def plugin_id(self) -> str:
        return "my-plugin"  # Must match manifest.json id

    async def pre_request(self, context: PluginContext) -> PluginResult:
        return PluginResult(
            proceed=True,
            modified_headers={"X-Custom-Header": "value"},
        )

Or use the built-in scaffold:

docker compose exec django python manage.py plugin new my-plugin --type python

Hooks

Hook When Can Block? Can Modify?
pre_request After auth, before proxying Yes (proceed=False) Headers, body
post_response After backend response No Headers, body
on_error On gateway error No Nothing (observational)

Lifecycle

Method Purpose
initialize() One-time setup at gateway startup
configure(config) Apply config from admin UI
cleanup() Teardown on shutdown or removal

Blocking a Request

from eyeriss_plugin_sdk.types import PluginResult, ErrorResponse

async def pre_request(self, context: PluginContext) -> PluginResult:
    if should_block(context):
        return PluginResult(
            proceed=False,
            error_response=ErrorResponse(
                status_code=403,
                body={"error": "Request denied"},
            ),
        )
    return PluginResult(proceed=True)

Configuration

Define config_schema in your manifest.json to expose settings in the Management UI. Supported field types: text, number, boolean, select, textarea, file.

See the Config Schema Reference for details.

Documentation

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

eyeriss_plugin_sdk-0.1.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

eyeriss_plugin_sdk-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file eyeriss_plugin_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: eyeriss_plugin_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for eyeriss_plugin_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 88c203d6f6e4981d2c6f2e172b1fd57a4704490d0ace77de156d9415444093d6
MD5 768cde2a19195a275bdf8b9af802c02d
BLAKE2b-256 a498a61738aaf29e8422742425308f9d8c2933afff2a73743c3a45d0cbc6ab47

See more details on using hashes here.

File details

Details for the file eyeriss_plugin_sdk-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for eyeriss_plugin_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d1c3d459f9f6eeb6293b46f36dac5605b33c7e54fc5187e393adabf9312ab880
MD5 e28472ad6cc40977f229d884b0d2f618
BLAKE2b-256 ba1e64348cc70ee2f065d5dc8e57c882fd3a7db1a70a25474a61f257a7911513

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