creating contrib package for plugins requiring extra dependencies

pull/256/head
Andrew Mirsky 2025-07-08 22:28:56 -04:00
rodzic 17f82a7eda
commit c72ddfa334
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
8 zmienionych plików z 38 dodań i 33 usunięć

Wyświetl plik

@ -0,0 +1 @@
"""Package for plugins contributed by community members."""

Wyświetl plik

@ -0,0 +1,29 @@
# Contributed Plugins
Beyond the original set of plugins created for aMQTT, `amqtt.contrib` plugins have been
more recently developed and contributed to the amqtt code base. These plugins require extra
dependencies:
`pip install amqtt[contrib]`
### Session Persistence
`amqtt.plugins.persistence.SessionDBPlugin`
Plugin to store session information and retained topic messages in the event that the broker terminates abnormally.
This plugin requires additional dependencies:
**Configuration**
- `file` - *(string)* path & filename to store the session db. default: `amqtt.db`
- `clear_on_shutdown` *(bool)* if the broker shutdowns down normally, don't retain any information. default: `True`
```yaml
plugins:
amqtt.plugins.persistence.SessionDBPlugin:
file: 'amqtt.db'
clear_on_shutdown: True
```

Wyświetl plik

@ -1,4 +1,4 @@
# Existing Plugins # Packaged Plugins
With the aMQTT plugins framework, one can add additional functionality without With the aMQTT plugins framework, one can add additional functionality without
having to rewrite core logic in the broker or client. Plugins can be loaded and configured using having to rewrite core logic in the broker or client. Plugins can be loaded and configured using
@ -240,29 +240,3 @@ and `on_mqtt_packet_received`.
plugins: plugins:
amqtt.plugins.logging_amqtt.PacketLoggerPlugin: amqtt.plugins.logging_amqtt.PacketLoggerPlugin:
``` ```
### Session Persistence
`amqtt.plugins.persistence.SessionDBPlugin`
Plugin to store session information and retained topic messages in the event that the broker terminates abnormally.
This plugin requires additional dependencies:
`pip install amqtt[db]`
**Configuration**
- `file` - *(string)* path & filename to store the session db. default: `amqtt.db`
- `clear_on_shutdown` *(bool)* if the broker shutdowns down normally, don't retain any information. default: `True`
```yaml
plugins:
amqtt.plugins.persistence.SessionDBPlugin:
file: 'amqtt.db'
clear_on_shutdown: True
```

Wyświetl plik

@ -40,6 +40,7 @@ nav:
- Plugins: - Plugins:
- Packaged: packaged_plugins.md - Packaged: packaged_plugins.md
- Custom: custom_plugins.md - Custom: custom_plugins.md
- Contributed: contrib_plugins.md
- Configuration: - Configuration:
- Broker: references/broker_config.md - Broker: references/broker_config.md
- Client: references/client_config.md - Client: references/client_config.md

Wyświetl plik

@ -80,7 +80,7 @@ docs = [
[project.optional-dependencies] [project.optional-dependencies]
ci = ["coveralls==4.0.1"] ci = ["coveralls==4.0.1"]
db = [ contrib = [
"aiosqlite>=0.21.0", "aiosqlite>=0.21.0",
"greenlet>=3.2.3", "greenlet>=3.2.3",
"sqlalchemy[asyncio]>=2.0.41", "sqlalchemy[asyncio]>=2.0.41",

10
uv.lock
Wyświetl plik

@ -37,7 +37,7 @@ dependencies = [
ci = [ ci = [
{ name = "coveralls" }, { name = "coveralls" },
] ]
db = [ contrib = [
{ name = "aiosqlite" }, { name = "aiosqlite" },
{ name = "greenlet" }, { name = "greenlet" },
{ name = "sqlalchemy", extra = ["asyncio"] }, { name = "sqlalchemy", extra = ["asyncio"] },
@ -84,19 +84,19 @@ docs = [
[package.metadata] [package.metadata]
requires-dist = [ requires-dist = [
{ name = "aiosqlite", marker = "extra == 'db'", specifier = ">=0.21.0" }, { name = "aiosqlite", marker = "extra == 'contrib'", specifier = ">=0.21.0" },
{ name = "coveralls", marker = "extra == 'ci'", specifier = "==4.0.1" }, { name = "coveralls", marker = "extra == 'ci'", specifier = "==4.0.1" },
{ name = "dacite", specifier = ">=1.9.2" }, { name = "dacite", specifier = ">=1.9.2" },
{ name = "greenlet", marker = "extra == 'db'", specifier = ">=3.2.3" }, { name = "greenlet", marker = "extra == 'contrib'", specifier = ">=3.2.3" },
{ name = "passlib", specifier = "==1.7.4" }, { name = "passlib", specifier = "==1.7.4" },
{ name = "psutil", specifier = ">=7.0.0" }, { name = "psutil", specifier = ">=7.0.0" },
{ name = "pyyaml", specifier = "==6.0.2" }, { name = "pyyaml", specifier = "==6.0.2" },
{ name = "sqlalchemy", extras = ["asyncio"], marker = "extra == 'db'", specifier = ">=2.0.41" }, { name = "sqlalchemy", extras = ["asyncio"], marker = "extra == 'contrib'", specifier = ">=2.0.41" },
{ name = "transitions", specifier = "==0.9.2" }, { name = "transitions", specifier = "==0.9.2" },
{ name = "typer", specifier = "==0.15.4" }, { name = "typer", specifier = "==0.15.4" },
{ name = "websockets", specifier = "==15.0.1" }, { name = "websockets", specifier = "==15.0.1" },
] ]
provides-extras = ["ci", "db"] provides-extras = ["ci", "db", "contrib"]
[package.metadata.requires-dev] [package.metadata.requires-dev]
dev = [ dev = [