Skip to main content

A high-level Python REST web framework based on Flask, Rick and RickDb.

Project description

Welcome to Pokie

Tests pypi license

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

  1. Create the application entrypoint, called main.py:
from rick.resource.config import EnvironmentConfig
from pokie.config import PokieConfig
from pokie.core import FlaskApplication
from pokie.core.factories.pgsql import PgSqlFactory


class Config(EnvironmentConfig, PokieConfig):
    # @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()
  1. Use our application to scaffold a module:
$ python3 main.py codegen:module my_module_name .
  1. Add your newly created module to the module list on main.py:
    (...)
    # modules to load & initialize
    modules = [
        'my_module_name',  # our newly created module
        
    ]
    (...)
  1. Implement the desired logic in the module

Running tests with tox

  1. Install tox & tox-docker:
$ pip install -r requirements-test.txt
  1. Run tests:
$ tox [-e py<XX>]

Project details


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.9.4.tar.gz (70.9 kB view details)

Uploaded Source

File details

Details for the file pokie-0.9.4.tar.gz.

File metadata

  • Download URL: pokie-0.9.4.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pokie-0.9.4.tar.gz
Algorithm Hash digest
SHA256 a5094e7e7d2dc68551d4ab38eef966b8d76c3645cf28c9d724ab2ddea4350fef
MD5 197abc22b103ff1bcaf509b4717c1820
BLAKE2b-256 2dc968df644c9999524bf7662e32e0ee51ecc5fff91026f26a2c965b72f2b796

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page