FuncToWeb examples

August 9, 2026 · View on GitHub

docs/ is the technical reference; this folder is the hands-on part, and it holds two kinds of file.

Examples teach a single capability and nothing else: 81 of them, in the 11 folders of the table below. Mini-apps live in project/ and do the opposite — each one combines several capabilities into a small complete application, to show how the pieces sit together once there is more than one.

Both kinds are runnable programs: a file with an if __name__ == "__main__": guard, which is what the count in the main README means. That is every .py file here, nothing in the collection is a module that only exists to be imported.

Running

python examples/basic/hello.py
python examples/project/todo.py

Examples and mini-apps alike serve at http://127.0.0.1:8000 and block until Ctrl+C. The clients in examples/http/ exit on their own.

Example folders

FolderWhat it teachesDocumentation
basic/run(), parameters, WebFunction, WebFunctions, space title, page_of()getting-started, web-function
types/scalars, date, time, enums, optionals, lists, unions, dataclassestypes
validation/Min, Max, MultipleOf, Choices, Pattern, Slider, Rows, IsPassword, Color, Emailtypes
forms/OpenForm, hidden fields and prefill via the URLprefill, open-form
files/IsPathFile, extensions, sizes, lists, references, storage on arrival, max_upload_bytes, expiry, storage locationfiles
outputs/text, multiple outputs, errors and Downloadoutputs
outputs_optional/images and tables with optional dependenciesoutputs
streaming/live print(), progress and capture_printsstreaming
fastapi/app_of(), prefixes, your own routes, iframes, sdk.js and modals that run themselvesapplication, sdk
themes/system, light and dark in run() and app_of()static-assets
http//invoke, /invoke-stream, /upload and /doc from a clienthttp, api-docs

Mini-apps

Mini-appWhat it combinesDocumentation
project/todo.pyone dataclass model reused by three functions, app_of() under a prefix, a hand-written route of your owntypes, application
project/todo_stored.pythe same mini-app whose tasks survive the restart: the dict becomes a store and the model that draws the forms is what the JSON file holdstypes, application

A mini-app is still short enough to read in one sitting, and it is still an ordinary FastAPI application: the library contributes an application, never the host.

Dependencies

Everything works with pip install func-to-web, except outputs_optional/, where each subfolder declares its own (pillow, matplotlib, pandas, polars, numpy), and project/todo_stored.py, which needs pytypehintstore. None of them is required by the library.

The examples use fictional data, never access the Internet and write only to the system temporary directories, with two deliberate exceptions: files/storage_dir.py points uploads_dir at a storage/ folder beside itself, because where the files land is its lesson, and project/todo_stored.py keeps its store in a data/ folder beside itself, for the same reason — the file it writes is what it is teaching.