Engrate SDK for plugin developers
Project description
Engrate SDK
A utility SDK providing common services for logging, configuration, and HTTP clients to connect the Engrate Platform.
Features
- Simple and consistent logging interface
- Flexible configuration management
- HTTP client utilities for seamless API integration
- TypeScript support
Installation
Add the dependency to your project configuration (i.e. UV):
"engrate-sdk ~= 0.0.16"
Then update your local environment
uv pip install .
Usage
from engrate_sdk import Logger, Config, HttpClient
# Logging
logger = Logger()
logger.info('Engrate SDK initialized')
# Configuration
config = Config()
config.load_from_env()
# HTTP Client
client = HttpClient(base_url=config.get('API_URL'))
response = client.get('/status')
Registry
The library contains a regystry.py module which provides access to our internal plugin registry. Every plugin has to call to the register_plugin() method
at some point in the plugin bootstrap process (if using ```FastAPI``this is usually recommended to use a lifespan function).
@asynccontextmanager
async def lifespan(fast_app: FastAPI):
"""Startup and shutdown logic using lifespan events."""
try:
print("Validating environment variables...")
env.validate()
if env.should_register():
logger.info("Registering plugin...")
plugin = PluginRegistry(registrar_url=env.get_registrar_url())
await plugin.register_plugin()
yield
finally:
logger.info("Shutting down application...")
This method will look for a plugin_manifest.yamlfile at root level of the project (it's also possible to provide an url when initializing the PluginRegistryobject) This file must exist and contain the following format (WIP: this might change in the near future):
name: "power-tariffs"
author: "Energy development solutions"
description: "Test plugin to use Engrate SDK"
product_category: "market_intelligence"
extensions:
markets:
- "*"
- "nl"
- "de"
- "se"
plugin_metadata:
display_name: "Demo Plugin"
service_name: "demo-plugin"
url_prefix: "demo-plugin"
fav_icon: ""
image: ""
port: "3111"
api_version: "v1"
flavors:
- "external-api"
traits:
- "storage"
Mock registrar
For testing purposes, the library includes a mock registrarthat mimics the behaviour for the actual registrar in the core services. This is a simple FastApi server that will
implement the required endpoints for puglins lifecycle.
Documentation
[TODO]
License
[TBD]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 engrate_sdk-0.0.23.tar.gz.
File metadata
- Download URL: engrate_sdk-0.0.23.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e102d2a4c46b1a53751c3c674da5dbec38568cca750aedbbca83c6c398ca79b4
|
|
| MD5 |
2cf7d9d7f18413b20ef92e6f0aecfd8f
|
|
| BLAKE2b-256 |
31af1ee7fa7de4003d40218bad2b6cdbf0b4a779ec34864f89433b72bdcb2dc6
|
Provenance
The following attestation bundles were made for engrate_sdk-0.0.23.tar.gz:
Publisher:
release.yaml on engrate/engrate-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
engrate_sdk-0.0.23.tar.gz -
Subject digest:
e102d2a4c46b1a53751c3c674da5dbec38568cca750aedbbca83c6c398ca79b4 - Sigstore transparency entry: 545447953
- Sigstore integration time:
-
Permalink:
engrate/engrate-sdk@135f9d66b96a5bc0de38f7fd2b76475f3fd125da -
Branch / Tag:
refs/tags/v0.0.23 - Owner: https://github.com/engrate
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@135f9d66b96a5bc0de38f7fd2b76475f3fd125da -
Trigger Event:
push
-
Statement type:
File details
Details for the file engrate_sdk-0.0.23-py3-none-any.whl.
File metadata
- Download URL: engrate_sdk-0.0.23-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f762f114ab2d370a3fd3badcd597395bd78b0c9483bcef73ec096c1650c6d5d
|
|
| MD5 |
a1e3a9e2f49b9709a74a94b21e6d1526
|
|
| BLAKE2b-256 |
afcaaccf373303df52456600ebf9efb2a83d55a1472ff55f435f7973987f1b6b
|
Provenance
The following attestation bundles were made for engrate_sdk-0.0.23-py3-none-any.whl:
Publisher:
release.yaml on engrate/engrate-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
engrate_sdk-0.0.23-py3-none-any.whl -
Subject digest:
6f762f114ab2d370a3fd3badcd597395bd78b0c9483bcef73ec096c1650c6d5d - Sigstore transparency entry: 545447960
- Sigstore integration time:
-
Permalink:
engrate/engrate-sdk@135f9d66b96a5bc0de38f7fd2b76475f3fd125da -
Branch / Tag:
refs/tags/v0.0.23 - Owner: https://github.com/engrate
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@135f9d66b96a5bc0de38f7fd2b76475f3fd125da -
Trigger Event:
push
-
Statement type: