Simple extension system for extending Takumi framework
Project description
Simple extension system for extending Takumi framework.
Install
$ pip install takumi-ext
Example
Here is an extension for running codes before app starts and after app exists.
app = AppRunner()
app_runner_ext = ext['app-runner']
if app_runner_ext:
runner_ext = app_runner_ext(app)
app.cfg.set('when_ready', lambda x: runner_ext.on_start())
app.cfg.set('on_exit', lambda x: runner_ext.on_exit())
app.run()
To implement this extension:
# package name runner_ext
class RunnerExt(ExtBase):
name = 'app-runner'
def __init__(self, app):
self.app = app
def on_start(self):
print('app starting...')
def on_exit(self):
print('app existing...')
Add the following config to app.yml to use the extension:
extensions:
- runner_ext
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for takumi_ext-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73e7798e4831df3c2ee4098aa37aca93343764f2d5ee4cadc15bfde6dd2e141c |
|
MD5 | 1531b3ff7fcbc649c7c6c1d5ab7b7ebb |
|
BLAKE2b-256 | dc9f3512c46b71043340571d085c0ca9c7dcc822eb82353bcb84e5e2713b421c |