1.6 KiB
1.6 KiB
pyappengine
A Python framework for building modular, command-based applications with dynamic module loading, thread-safe command dispatch, and structured lifecycle management.
Features
- Dynamic module loading — drop a
cmds_*.pyfile in your module directory, it's loaded automatically - Thread-safe command dispatch — shared lock across all modules
- Threaded modules — opt-in background thread execution per module
- Inter-module dependencies — declarative dependency injection between modules
- Built-in help system — introspects docstrings at runtime
- INI configuration — per-module config sections
- Graceful shutdown — SIGINT handler + global stop event
Installation
pip install pyappengine
Quick start
1. Create your application entry point:
from appengine import AppEngine
app = AppEngine(
"my_app",
conf_file="config.ini",
log_file="my_app.log",
debug=True,
)
app.exec(modpath="./modules")
2. Create a module — save as modules/cmds_hello.py:
from appengine import Commands
class Hello(Commands):
def cmd_greet(self, name: str):
"""Greet someone.
Args:
name: The person to greet.
Returns:
str: A greeting string.
"""
return f"Hello, {name}!"
3. Create a minimal config — config.ini:
[general]
default = hello
License
Released under the CeCILL-C license.
Author: François Dausseur — fdausseur@free.fr