Skip to main content

front

A toolkit for building UI frameworks: it compiles Python functions plus a short configuration into a spec and a tree of UI elements, and the framework renders it.

Want a UI for your functions right now? Use a concrete framework built on front, such as streamlitfront (pip install streamlitfront):

# app.py, run with: streamlit run app.py
from streamlitfront import mk_app


def add(a: int, b: int = 2):
    """Adds a and b."""
    return a + b


mk_app([add])()

To build such a framework yourself, install front and read on.

pip install front

Quick example

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

  1. SpecMakerBase.mk_spec compiles a short-language configuration (plus a convention of defaults) into a long-language FrontSpec (app_spec, obj_spec, rendering_spec).
  2. ElementTreeMaker.mk_tree builds a composite tree of FrontElementBase elements from the rendering spec: a root container (e.g. FrontContainerBase) with one child per object, built from FrontComponentBase/InputBase/OutputBase subclasses.
  3. AppMaker.mk_app chains 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.

Metadata

Release files for front 0.1.116

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

Source distribution (sdist)

Source distribution for front 0.1.116
File Size Uploaded Provenance Actions
front-0.1.116.tar.gz 279.0 kB Without provenance Details for front-0.1.116.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for front 0.1.116
File Interpreter ABI Platform Actions
front-0.1.116-py3-none-any.whl Python 3 none any Details for front-0.1.116-py3-none-any.whl

Total release size: 567.8 kB

Release files / front-0.1.116.tar.gz

Download URL front-0.1.116.tar.gz
Size 279.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0db83b9f8d5dd2d9d03b66a6fbe88314434866580d3acb3e83d4de772c51d503
BLAKE2b-256 checksum
How to use checksums
a3e7eb949958fdf4a34a9d3d17ea169c41d790df5a4b9c73ecb9f84852f55b89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / front-0.1.116-py3-none-any.whl

Download URL front-0.1.116-py3-none-any.whl
Size 288.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5df1ebe99be23607f92aae104b9865149a16f514f76b90cfa6c5a0296368237
BLAKE2b-256 checksum
How to use checksums
90a8a8bda064cf1d47399f1cae9c1fc4a121536498d2d37763eaf9072a12fca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for front 0.1.116

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

This release

0.1.116 This release

2 release files No provenance

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