A high-level Python REST web framework based on Flask, Rick and RickDb.
Project description
Welcome to Pokie
Pokie is an API-oriented modular web framework built on top of Flask, Rick and Rick-db libraries, following three-layer and clean architecture design principles.
It features a object-oriented design, borrowing from common patterns found in other languages, such as dependency injection, service location, factories and object composition. It also offers the following functionality:
- Modular design;
- Dependency registry;
- CLI command support;
- Jobs (objects invoked periodically to perform a task);
- Fixtures;
- Unit testing support with pytest;
- Code generation;
- REST-oriented service design;
- Compatibility with Flask;
For detailed information, please check the Documentation
TL; DR; tutorial
- Create the application entrypoint, called main.py:
from rick.resource.config import EnvironmentConfig
from pokie.config.template import BaseConfigTemplate, PgConfigTemplate, TestConfigTemplate
from pokie.core import FlaskApplication
from pokie.core.factories.pgsql import PgSqlFactory
class Config(EnvironmentConfig, BaseConfigTemplate, PgConfigTemplate, TestConfigTemplate):
# @todo: add your config options or overrides here
pass
def build_pokie():
# load configuration from ENV
cfg = Config().build()
# modules to load & initialize
modules = [
#@ todo: add your modules here
]
# factories to run
factories = [
PgSqlFactory,
# @todo: add additional factories here
]
# build app
pokie_app = FlaskApplication(cfg)
flask_app = pokie_app.build(modules, factories)
return pokie_app, flask_app
main, app = build_pokie()
if __name__ == '__main__':
main.cli()
- Use our application to scaffold a module:
$ python3 main.py codegen:module my_module_name .
- Add your newly created module to the module list on main.py:
(...)
# modules to load & initialize
modules = [
'my_module_name', # our newly created module
]
(...)
- Implement the desired logic in the module
Running tests with tox
- Install tox & tox-docker:
$ pip install -r requirements-test.txt
- Run tests:
$ tox [-e py<XX>]
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
Pokie-0.8.0.tar.gz
(63.3 kB
view details)
File details
Details for the file Pokie-0.8.0.tar.gz
.
File metadata
- Download URL: Pokie-0.8.0.tar.gz
- Upload date:
- Size: 63.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffbbd096fcd97d105630539ddfdcaf3a9a36fe8a6da4ea5f6403290769f0ea90 |
|
MD5 | c266cded0fc7dc3827671a5f4a323a98 |
|
BLAKE2b-256 | 0a8748e547e1291adf7279802187e8ef53c0289e46c8549d05456e0747f8e139 |