Type hints → Web UI. Turn Python functions into web apps — standalone or mounted inside yours.
One typed Python function → form + iframe + HTTP endpoint, simultaneously. It's a library, not a framework: it composes with what you already have.
- Standalone —
run(func). Internal tools, admin panels, scripts. The auto-generated UI is the app. - Mounted —
create_app(funcs)returns a plain FastAPI app. Mount it under any prefix of your existing app; every URL adapts automatically. - Embedded — drop forms into existing sites via
<iframe>with URL prefill. "Export to PDF" buttons, CSV importers, modal editors. - Backend for your own SPA — drop your built bundle in
front_dir=and static files inassets_dir=— served alongside your functions by the same process.
Validation, file uploads, SSE streaming, downloads, custom widgets and outputs via return types and Annotated metadata — all built-in. Auto-generated API docs at /doc for scripts and AI agents: write a function, get a UI and an API for free.
pip install func-to-webfrom func_to_web import run
def divide(a: float, b: float):
return a / b
run(divide)Open http://127.0.0.1:8000. Done.
from fastapi import FastAPI
from func_to_web import create_app
def add(a: int, b: int):
return a + b
host = FastAPI()
host.mount("/tools", create_app(add))uvicorn app:hostOpen http://127.0.0.1:8000/tools. Forms, validation, downloads, navigation — everything works under the prefix, zero configuration.
Full docs with examples and screenshots: offerrall.github.io/FuncToWeb
| Type | Widget | Docs |
|---|---|---|
int, float |
Number / slider | → |
str, Email |
Text / textarea / password | → |
bool |
Toggle | → |
date, time |
Pickers | → |
Color |
Hex picker | → |
File, ImageFile, VideoFile, ... |
Upload | → |
Literal, Enum, Dropdown(func) |
Select | → |
list[T] |
Dynamic list | → |
T | None |
Toggle + input | → |
Params |
Reusable groups | → |
Annotated[T, ...] |
Type Composition, Constraints, labels, sliders | → |
| Return type | Rendered as | Docs |
|---|---|---|
str, int, float, None |
Text + copy button | → |
PIL Image, Matplotlib Figure |
Inline image | → |
FileResponse |
Download button | → |
DataFrame, list[dict], ... |
Table | → |
ActionTable |
Clickable rows → next function | → |
tuple / list |
Multiple outputs | → |
print() |
Streamed live | → |
create_app()— get a mountable FastAPI app, serve by import string (workers, reload) — docs- Multiple functions with index page or groups — docs
- URL prefill — open forms with values from query params — docs
- Embed mode — drop any form into your site via
?__embed=1— docs - Auto-generated API docs at
/docfor scripts and AI agents — docs - Dark mode — docs
- Server config — host, port, reverse proxy — docs
File transfer
from func_to_web import run, File
import shutil, os
downloads = os.path.expanduser("~/Downloads")
def upload_files(files: list[File]):
for f in files:
shutil.move(f, downloads)
return "Done."
run(upload_files)QR code generator
import qrcode
from func_to_web import run
def make_qr(text: str):
return qrcode.make(text).get_image()
run(make_qr)Admin panel
import subprocess
from typing import Literal
from func_to_web import run
def restart_service(service: Literal['nginx', 'gunicorn', 'celery']):
subprocess.run(["sudo", "supervisorctl", "restart", service], check=True)
return f"{service} restarted."
# Deploy sensitive tools behind a reverse proxy with auth (e.g. Nginx
# basic auth) — see docs/config.md.
run(restart_service)More in examples/ — including a full CRUD app in 70 lines using Params + ActionTable.
pip install func-to-web # stable
pip install git+https://github.com/offerrall/FuncToWeb.git # latestRequirements: Python 3.10+. Core deps installed automatically; Pillow, Matplotlib, Pandas, NumPy and Polars are optional.
Built on pytypeinput and pytypeinputweb, usable standalone for CLIs, Qt apps, etc.
Feedback, issues and contributions welcome — they keep the project moving.
MIT License · Made by Beltrán Offerrall

