Skip to main content

Welcome to Pokie

Tests pypi license

Pokie is an REST web framework built on top of Flask, Rick and Rick-db libraries, following three-layer and clean architecture design principles.

It features an 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 and factories;
  • Configuration via environment variables or JSON files;
  • CLI command support;
  • Events and signal handlers;
  • Caching (Redis, in-memory, dummy);
  • Jobs with per-job intervals, retry/backoff, and timeouts;
  • CORS and rate limiting via built-in factories;
  • OpenAPI 3.0 spec generation from registered routes;
  • Fixtures;
  • Unit testing support with pytest;
  • Code generation;
  • Automatic REST endpoint generation;
  • REST-oriented service design;
  • Compatibility with Flask;
  • Forward-only SQL migrations;
  • PostgreSQL support;

For detailed information, please check the Documentation

Automatic REST from Database Tables

Generate full CRUD endpoints directly from a database table — no DTO, no RequestRecord, no service class needed:

from pokie.core import BaseModule
from pokie.http import AutoRouter
from pokie.rest.auto import Auto


class Module(BaseModule):
    name = "my_module"

    def build(self, parent=None):
        app = parent.app

        # generate a full REST view from the "customers" table
        view = Auto.view(app, "customers")
        AutoRouter.resource(app, "customer", view, id_type="string")

This introspects the customers table at startup and registers:

URL Method Operation
/customer GET List records
/customer/<string:id_record> GET Get by id
/customer POST Create
/customer/<string:id_record> PUT, PATCH Update
/customer/<string:id_record> DELETE Delete

Listing supports server-side pagination, sorting, filtering and free-text search out of the box via query parameters (offset, limit, sort, match, search).

Automatic REST from DTO Records

For more control, use Auto.rest() with a DTO Record — Pokie generates the RequestRecord and service automatically:

from rick_db import fieldmapper
from pokie.core import BaseModule
from pokie.rest.auto import Auto


@fieldmapper(tablename="customers", pk="customer_id")
class CustomerRecord:
    id = "customer_id"
    company_name = "company_name"
    contact_name = "contact_name"


class Module(BaseModule):
    name = "my_module"

    def build(self, parent=None):
        Auto.rest(
            parent.app,
            "customer",
            CustomerRecord,
            search_fields=[CustomerRecord.company_name, CustomerRecord.contact_name],
            id_type="string",
        )

Both approaches can be incrementally customized — add a custom RequestRecord for input validation, a custom service for business logic, or a custom base class for authentication.

Getting Started

  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):
    pass


def build_pokie():
    cfg = Config().build()

    modules = [
        # add your modules here
    ]

    factories = [
        PgSqlFactory,
    ]

    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. Scaffold a module:
$ python3 main.py codegen:module my_module_name .
  1. Add the module to the module list on main.py:
    modules = [
        'my_module_name',
    ]
  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>]

Metadata

Release files for Pokie 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Pokie 1.2.0
File Size Uploaded Provenance
pokie-1.2.0.tar.gz 80.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for Pokie 1.2.0
File Interpreter ABI Platform
pokie-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 200.7 kB

Release files / pokie-1.2.0.tar.gz

Download URL pokie-1.2.0.tar.gz
Size 80.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c7c6eb93ffc9a90422423313962a385d825ac98af056fbac1f4c2cd330dd4809
BLAKE2b-256 checksum
How to use checksums
d230d669424f3abc2624d0de66b5fcf52a50e87742785217743baf532e37c60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / pokie-1.2.0-py3-none-any.whl

Download URL pokie-1.2.0-py3-none-any.whl
Size 120.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef47ea3fc89c50b9f9319c817edb5120969c610427fb94e570dbdb1aaa833606
BLAKE2b-256 checksum
How to use checksums
19a62f41edac9e78f4ef7d9e3746533595d9511e002a453c5e809d82111b62a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Security for Pokie 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pokie-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page