Skip to main content

A composable dependency container with passive UI and service facets.

Project description

facetkit

A composable Python container for application state and passive registries — CLI commands, TUI screens, GUI widgets, web routes, and background services.

facetkit separates three pieces:

Piece Role
Container Application root — config, facet mounting, component lifecycle
Facet Passive registry for a surface area (commands, routes, widgets, …)
Component Plugin that registers into facets on attach and cleans up on detach
Container
├── config
├── components
└── facets
    ├── cli      → commands
    ├── tui      → screens, keybindings
    ├── gui      → widgets, menus, toolbars, layouts
    ├── web      → routes, middleware, error handlers
    └── service  → tasks, providers

Requirements

Installation

pip install facetkit

For local development:

git clone https://github.com/Dev-DanielR/py_facetkit.git
cd facetkit
pip install -e ".[dev]"

Quick start

from facetkit import Container, CliFacet, WebFacet

app = Container({"app": {"name": "demo"}})

app.mount_facet("cli", CliFacet())
app.mount_facet("web", WebFacet())

def hello():
    """Say hello."""
    return "Hello!"

app.facets["cli"].add_command("hello", hello)
app.facets["web"].add_route("hello", "/hello", lambda: {"message": "Hello!"}, methods=["GET"])

Register directly on facets (as above) or through components. Your dispatch layer reads the registries and wires them to argparse, FastAPI, Textual, Qt, or whatever you use.

Documentation

  • Container — config, lifecycle, introspection
  • Facets — facet types, registries, mounting
  • Components — attach/detach, dependencies
  • Examples — composed app with logger and status components

Development

pip install -e ".[dev]"
pytest

See CHANGELOG.md for release notes. Pre-1.0 (0.3.0) — public APIs may change between minor releases.

License

MIT — see LICENSE.

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

facetkit-0.3.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

facetkit-0.3.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file facetkit-0.3.0.tar.gz.

File metadata

  • Download URL: facetkit-0.3.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for facetkit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e6987183a4afd34e7ff152ab2d8aa4c37a493556e844fa03fe398f8ff58da5a0
MD5 42fde777659457493e0eccd2ef3ddf76
BLAKE2b-256 841f420a78aa88930891e27cf3431a9e780592e7241372f1cd6cb510e92bbdcf

See more details on using hashes here.

File details

Details for the file facetkit-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: facetkit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for facetkit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7a44b53d83457af94d1f62d5e5816a3c928108111bd41898238fa9a2da4a53c
MD5 cb6532dc2a45ffac35f606992227368c
BLAKE2b-256 1051701664e5a9da28cda2a71c192ba512381b6d85b3c5071d34f1db06048775

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