pluginkit
Create and manage plugins in a modular way
Summary
| Latest Version | 0.2.0 |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-09-04 07:26 |
Tags
Authors
- George Lemon
Installation
nimble install pluginkit
choosenim install pluginkit
git clone https://github.com/openpeeps/pluginkit
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| pluginkit | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 2.0.0 | No |
| semver >= | 1.2.3 | No |
| checksums >= | 0.2.2 | No |
| openparser >= | 0.1.9 | No |
Source
| Repository | https://github.com/openpeeps/pluginkit |
|---|---|
| Homepage | https://github.com/openpeeps/pluginkit |
| Registry Source | nimble_official |
README
A plugin kit for creating and managing plugins in your 👑 Nim applications.
nimble install pluginkit
😍 Key Features
- Dynamic Plugin Loading - Dynamic libraries (
.so,.dll,.dylib) using Nim’sstd/dynlib - Stable Plugin ABI - C-compatible manifest structure and exported entry points (
plugin_get_manifest,plugin_init,plugin_deinit) - Plugin Metadata & Manifest, including name, version, author, description, license, URL, and permissions
- Plugin Lifecycle Management with
onloadandonunloadcallbacks for initialization and cleanup - Permission System to control plugin capabilities and API access
- Macro-based Plugin Definition
- Semantic Versioning Support
- Callbacks & Extensible Manager
- Cross-platform support for dynamic libraries on Windows, Linux, and macOS.
Examples
Creating a Simple Plugin
Here is an example creating a simple plugin that logs a message when initialized:
import pluginkit
plugin helloworld, {
name: "HelloWorld",
author: "George Lemon",
description: "A simple plugin that prints 'Hello, world!' to the console.",
license: "MIT",
url: "https://github.com/openpeeps/pluginkit",
permissions: {permissionEmitEvents, permissionHandleRequests}
}:
onload do:
# This code will be executed when the plugin is loaded.
echo "Hello, world!"
onunload do:
# This code will be executed when the plugin is unloaded.
echo "Goodbye, world!"
Now, compile this plugin as a dynamic library and load it in your application using the PluginManager:
nim c --app:lib helloworld.nim
Initializing the Plugin Manager
To use the PluginManager, you can initialize it in your application like this:
import pluginkit
var manager = PluginManager(
callbacks: PluginManagerCallbacks(
onPluginLoaded: proc (plugin: Plugin) =
echo plugin.getId()
echo "Plugin loaded: ", plugin.getName, " by ", plugin.getAuthor
,onPluginUnloaded: proc (plugin: Plugin) =
echo "Plugin unloaded: ", plugin.getName
,onPluginError: proc (plugin: Plugin, error: string) =
echo "Error in plugin ", plugin.getName, ": ", error
))
for path in walkFiles("./plugins):
if path.endsWith(".so") or path.endsWith(".dll") or path.endsWith(".dylib"):
manager.load(path)
Todo
- [ ] Add support for version constraints
- [ ] Extend the permission system with more granular permissions and API exposure
- [ ] Implement plugin dependency management
- [ ] Unit tests for plugin loading, lifecycle events, and permission checks
- [ ] Example plugins demonstrating various features and use cases
- [ ] Embedding Static Assets via Supra CLI
- [ ] Plugin sandboxing and security enhancements
❤ Contributions & Support
- 🐛 Found a bug? Create a new Issue
- 👋 Wanna help? Fork it!
🎩 License
MIT license. Made by Humans from OpenPeeps.
Copyright OpenPeeps & Contributors — All rights reserved.