Skip to main content

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

  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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

front-0.1.102.tar.gz (265.8 kB view details)

Uploaded Source

Built Distribution

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

front-0.1.102-py3-none-any.whl (280.2 kB view details)

Uploaded Python 3

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

Hashes for front-0.1.102.tar.gz
Algorithm Hash digest
SHA256 a980113c85049c7dfd54aa445421b9616404b7471abbe3791e8bd45e5c7d3bc4
MD5 a002fc2417ff2edafd28bcf9138e0830
BLAKE2b-256 3aaabcc429d1d48278371280d214d6f2a7e2e9d9aa2fa412bbae7068063da6f8

See more details on using hashes here.

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

Hashes for front-0.1.102-py3-none-any.whl
Algorithm Hash digest
SHA256 615c4a712a17abee8329703299b2a8d65673f29a592ec930dcc334e15d7f06bd
MD5 4d37959a5221f3c24e2048bccbc502f8
BLAKE2b-256 7d55181c6f2e24fa14ceea41f498a8fa3611b52798e2e28abd95b6469a8670f1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.102 This release

2 files

0.1.101

2 files

0.1.100

2 files

0.1.99

2 files

0.1.98

2 files

0.1.97

1 file

0.1.96

1 file

0.1.95

1 file

0.1.94

1 file

0.1.93

1 file

0.1.92

1 file

0.1.91

1 file

0.1.90

1 file

0.1.89

1 file

0.1.88

1 file

0.1.87

1 file

0.1.86

1 file

0.1.85

1 file

0.1.84

1 file

0.1.83

1 file

0.1.82

1 file

0.1.81

1 file

0.1.80

1 file

0.1.79

1 file

0.1.78

1 file

0.1.77

1 file

0.1.76

1 file

0.1.75

1 file

0.1.74

1 file

0.1.73

1 file

0.1.72

1 file

0.1.71

1 file

0.1.70

1 file

0.1.69

1 file

0.1.68

1 file

0.1.67

1 file

0.1.66

1 file

0.1.65

1 file

0.1.64

1 file

0.1.63

1 file

0.1.62

1 file

0.1.61

1 file

0.1.60

1 file

0.1.59

1 file

0.1.58

1 file

0.1.57

1 file

0.1.56

1 file

0.1.55

1 file

0.1.54

1 file

0.1.53

1 file

0.1.52

1 file

0.1.51

1 file

0.1.50

1 file

0.1.49

1 file

0.1.48

1 file

0.1.47

1 file

0.1.46

1 file

0.1.45

1 file

0.1.44

1 file

0.1.43

1 file

0.1.42

1 file

0.1.41

1 file

0.1.40

1 file

0.1.39

1 file

0.1.38

1 file

0.1.37

1 file

0.1.36

1 file

0.1.35

1 file

0.1.34

1 file

0.1.33

1 file

0.1.32

1 file

0.1.31

1 file

0.1.30

1 file

0.1.29

1 file

0.1.28

1 file

0.1.27

1 file

0.1.26

1 file

0.1.25

1 file

0.1.24

1 file

0.1.23

1 file

0.1.22

1 file

0.1.21

1 file

0.1.20

1 file

0.1.19

1 file

0.1.18

1 file

0.1.17

1 file

0.1.16

1 file

0.1.15

1 file

0.1.14

1 file

0.1.13

1 file

0.1.12

1 file

0.1.11

1 file

0.1.10

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

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