Show HN: Func-to-web – Turn Python functions into web UIs with zero boilerplate

2 weeks ago 2

I needed a tool to quickly prototype internal utilities for our company – PDF generators, data processors, file converters that non-technical colleagues could use.

func-to-web generates web UIs from Python function signatures with zero boilerplate:

```python from func_to_web import run

def divide(a: int, b: int): return a / b

run(divide) # Web UI at localhost:8000 ```

For more complex needs, it supports advanced types:

```python def process_data( scores: Annotated[ list[Annotated[int, Field(ge=0, le=100)]], Field(min_length=3, max_length=10) ], # 3-10 items, each 0-100 files: list[ImageFile], # Multiple file uploads email: Email, # Built-in validation notes: str | None = None # Optional with toggle ): return FileResponse(pdf_data, "report.pdf") # Auto-download

run(process_data) ```

Key features: - *Advanced lists*: Dynamic add/remove with constraints on both list size and items - *Optional fields*: `Type | None` creates toggle switches - *File handling*: Upload/download with progress bars, supports GB+ files - *Rich outputs*: Auto-displays PIL images, matplotlib plots, or downloadable files - *Dynamic dropdowns*: Runtime-generated options from functions - *Multiple functions*: Auto-generates index page

Not trying to replace full web frameworks, but for internal tools and quick utilities, this approach feels superior to writing HTML forms.

454 unit tests. Used daily for internal tools and rapid prototyping. Got 150 stars in the first week.

GitHub: https://github.com/offerrall/FuncToWeb

Sharing here in case others find it interesting too :)

Read Entire Article