Transform any Python function into a web interface automatically
Project description
Func To Web 1.0.1
Type hints → Web UI. Minimal-boilerplate web apps from Python functions.
Two use cases: standalone utilities (internal tools, admin panels, scripts) with no frontend, and adding isolated Python features to existing web apps (e.g. "Export to PDF" button, CSV importer). Write a typed function, embed via iframe or call over HTTP, and skip the routes, validation, and form code.
Quick start
pip install func-to-web
from func_to_web import run
def divide(a: float, b: float):
return a / b
run(divide)
Open http://127.0.0.1:8000. Done.
Full docs with examples and screenshots: offerrall.github.io/FuncToWeb
Inputs
| 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, ...] |
Constraints, labels, sliders | → |
Outputs
| Return type | Rendered as | Docs |
|---|---|---|
str, int, float, None |
Text + copy button | → |
PIL Image, Matplotlib Figure |
Inline image | → |
FileResponse |
Download button | → |
DataFrame, list[dict], ... |
Sortable table + CSV | → |
ActionTable |
Clickable rows → next function | → |
tuple / list |
Multiple outputs | → |
print() |
Streamed live | → |
Features
- 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 - Authentication with username/password — docs
- Dark mode — docs
- Server config — host, port, reverse proxy — docs
Examples
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)
Protected 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."
run(restart_service, auth={"admin": "your_password"})
More in examples/ and examples/apps/ — including a full CRUD app in 70 lines using Params + ActionTable.
Install
pip install func-to-web # stable
pip install git+https://github.com/offerrall/FuncToWeb.git # latest
Requirements: 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
Project details
Release history Release notifications | RSS feed
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 func_to_web-1.0.1.tar.gz.
File metadata
- Download URL: func_to_web-1.0.1.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ad7337e3826be04e9e78bc2945d37363da1e0a3a6696ffaf7c3a93b95123631
|
|
| MD5 |
3894bfaed3b510feb5688b0cc94a2b58
|
|
| BLAKE2b-256 |
587c7b1ae2406cfa6df0d08ad71796a5ea5531ee52a1d354f8ee6d425e633382
|
File details
Details for the file func_to_web-1.0.1-py3-none-any.whl.
File metadata
- Download URL: func_to_web-1.0.1-py3-none-any.whl
- Upload date:
- Size: 57.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c225d19441acd949475d0a4fd51425bb2c82b70af9d30455501618de481ac6ed
|
|
| MD5 |
3a0ad0f781b83f80673f7bc16da40705
|
|
| BLAKE2b-256 |
2549b93e2f7f261f407fe7cfcbd461504da84e9853a0682d8a6361d66abdd857
|