front
Compile a Python function's configuration into a runnable UI (web app, CLI, GUI...) without writing framework glue by hand.
To install: pip install front
Quick example
front itself is not a UI framework: it's the core library concrete front frameworks (e.g. streamlitfront) build on. A minimal in-memory framework, whose "app" is a container rendering each function's docstring:
from collections.abc import Callable
from front import SpecMakerBase, APP_KEY, OBJ_KEY, RENDERING_KEY, ELEMENT_KEY, AppMaker
from front.elements import FrontContainerBase, FrontComponentBase
from front.util import dflt_trans
class App(FrontContainerBase):
def render(self):
return {child.name: child() for child in self.children}
class Doc(FrontComponentBase):
def render(self):
return self.obj.__doc__
class SpecMaker(SpecMakerBase):
@property
def _dflt_convention(self):
return {
APP_KEY: {"title": "Untitled"},
OBJ_KEY: {"trans": dflt_trans},
RENDERING_KEY: {ELEMENT_KEY: App, Callable: {ELEMENT_KEY: Doc}},
}
def foo(a, b):
"Adds a and b."
return a + b
app_maker = AppMaker(spec_maker_factory=SpecMaker)
app = app_maker.mk_app([foo], config={APP_KEY: {"title": "My App"}})
app.name
# 'My App'
app()
# {'foo': 'Adds a and b.'}
The three-step workflow
SpecMakerBase.mk_speccompiles a short-language configuration (plus a convention of defaults) into a long-languageFrontSpec(app_spec,obj_spec,rendering_spec).ElementTreeMaker.mk_treebuilds a composite tree ofFrontElementBaseelements from the rendering spec: a root container (e.g.FrontContainerBase) with one child per object, built fromFrontComponentBase/InputBase/OutputBasesubclasses.AppMaker.mk_appchains the two and returns the root element, callable as the app.
To implement a concrete front framework, subclass SpecMakerBase to supply the concrete element classes as the default convention, and hand it to AppMaker (see the example above, and streamlitfront for a real one).
Crudifying functions
Crudifier/prepare_for_crude_dispatch (in front.crude) let functions with complex arguments (objects that don't fit in a text box or URL) be dispatched through string keys into stores instead — the "CRUD-Execution" pattern. front.dag applies the same crudification to the variable nodes of a meshed DAG.
Docs
Rendered documentation · flat front.md for a single-file view.
For AI agents
front publishes its documentation in forms made for coding agents. If you are one, start here.
The documentation, machine-readable: llms.txt indexes every page; front.md is the whole documentation in one file; every page has a .md twin; objects.inv maps symbols to URLs.
If you are a control freak, the rest of this README is written for you, starting at the top of the page.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file front-0.1.102.tar.gz.
File metadata
- Download URL: front-0.1.102.tar.gz
- Upload date:
- Size: 265.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a980113c85049c7dfd54aa445421b9616404b7471abbe3791e8bd45e5c7d3bc4
|
|
| MD5 |
a002fc2417ff2edafd28bcf9138e0830
|
|
| BLAKE2b-256 |
3aaabcc429d1d48278371280d214d6f2a7e2e9d9aa2fa412bbae7068063da6f8
|
File details
Details for the file front-0.1.102-py3-none-any.whl.
File metadata
- Download URL: front-0.1.102-py3-none-any.whl
- Upload date:
- Size: 280.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
615c4a712a17abee8329703299b2a8d65673f29a592ec930dcc334e15d7f06bd
|
|
| MD5 |
4d37959a5221f3c24e2048bccbc502f8
|
|
| BLAKE2b-256 |
7d55181c6f2e24fa14ceea41f498a8fa3611b52798e2e28abd95b6469a8670f1
|