Skip to main content

Funix.IO
⭐️ The laziest way to build AI/data apps in Python. ⭐️

Features

Funix is designed for an algorithm/ML engineer to build apps without writing code related to the UI, not even selecting a widget and passing it to or calling it in a Python function.

  • Minimalist: Automatic UI generation. No manual widget selection.
  • Centralized styling: Type-to-widget mapping stored in themes for cross-app UI consistency.
  • Declarative: All non-default controls, including UI customization, via Python dictionaries.
  • Non-intrusive: You can still run or debug your Python code locally as usual.

WIP: Funix is still under development. If you have any questions, please feel free to open an issue.

Hello, world in Funix

Building a web app in Funix is super easy. Just have a type-hinted Python function:

def hello(your_name: str) -> str:
    return f"Hello, {your_name}."

Save in a file (say hello.py) and pass to Funix:

funix -l hello.py

A web app will be launched at http://localhost:3000 and automatically opened in a browser window.

screenshots/hello.png

Note: The -l flag stands for "lazy" meaning that only default settings are used. It cannot be used when your function is decorated by the funix decorator @funix() which allows you to customize your app. See example usages below of the decorator.

Love Funix? Give us a star

Borrowed from AppFlowy

Installation

  • From PyPI (stable)

    pip install funix
    
  • From GitHub (latest)

    pip install "git+https://github.com/TexteaInc/funix.git"
    
  • Local development

    git clone https://github.com/TexteaInc/funix
    cd funix
    pip install -e . 
    

    Add --prefix=~/.local if pip insists to install to system paths. See #24 and #23

More examples in QuickStart Guide or the examples folder.

ChatGPT, multi-turn

Code here. Just 77 lines including the HTML layout code and tip messages.

Multiturn chat

Shortest Dall-E web app in Python

from funix import funix                      # add line one
from funix.hint import Images                # add line two
import openai  # pip install openai

openai.api_key = os.environ.get("OPENAI_KEY")

@funix()                                     # add line three
def dalle(prompt: str = "a cat") -> Image:
    response = openai.Image.create(prompt=prompt, n=1, size="1024x1024")
    return response["data"][0]["url"]

Dalle demo

Compound UIs

from typing import List
import matplotlib.pyplot as plt
from matplotlib.figure import Figure

@funix(
        widgets={
           "a": "sheet",
           "b": ["sheet", "slider[0,1,0.01]"]
        }
)

# below is a simple matplotlib function
def table_plot(a: List[int], b: List[float]) -> Figure:
    fig = plt.figure()
    plt.plot(a, b)
    return fig

table plot demo static

Layout

Code here

shipping example

Usage

Command line

funix [-h] [-H 127.0.0.1] [-p 3000] [-F] [-B] 

Funix: Building web apps without manually creating widgets

positional arguments:
  main_class            The Python module containing functions 
                        to be turned into web apps by Funix 

options:
  -h, --help            show this help message and exit
  -H 127.0.0.1, --host 127.0.0.1
                        Host of frontend and backend
  -p 3000, --port 3000  Port of frontend and backend
  -F, --no-frontend     Disable frontend server
  -B, --no-browser      Disable auto open browser

The command funix above is equivalent to python -m funix if you have installed Funix.

For example, to launch examples in the examples folder, run the following command:

cd examples
funix examples # same as `python -m funix examples`
funix examples_better # same as `python -m funix examples_better`

Call funix in Python

Besides starting Funix servers from the command line, you can also start Funix from Python:

import funix 
funix.run("localhost", 4010, "examples")

How to contribute

Funix is open-sourced under the MIT License. Community contribution is not only welcomed but desired. Feel free to fork and make a pull request when you are ready. You can also report bugs, suggest new features, etc. via the issue tracker.

Acknowledgement

Funix draws inspiration from FastAPI and Plac: building software interfaces by inferring from function signartures containing type hints. We port this idea from the backend (FastAPI) or the terminal (Python-Fire) to the frontend. We also wanna thank Streamlit, Gradio, PyWebIO, and Pynecone. They inspired us. We are just too lazy to manually define widgets imperatively. Funix’s backend is implemented in Flask and the frontend in Material UI. Lastly, Funix was made possible with the generous investment from Miracle Plus (formerly Y Combinator China) to Textea Inc.

Team

The Funix team at Textea consists of:

Metadata

Release files for funix 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for funix 0.4.4
File Size Uploaded
funix-0.4.4.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for funix 0.4.4
File Interpreter ABI Platform
funix-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 4.8 MB

Release files / funix-0.4.4.tar.gz

Download URL funix-0.4.4.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ec171e1418e41e8cb515f305ffe69d3c3de3af117c9e9ebde073eec95347e023
BLAKE2b-256 checksum
How to use checksums
51a4a5a8e3ca9b41b587afb27be97bc6f036299a924175e5dc40da717190633c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / funix-0.4.4-py3-none-any.whl

Download URL funix-0.4.4-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
7e64175bc5776c1cdc17f3b2f8eea4ac33fdb9d0f0671bedc4cc1732f61aea3c
BLAKE2b-256 checksum
How to use checksums
7414c1685019fd2b7f4f6f1b100a42a4eff7e486c1c03eb26d28ae1aab7d328d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release 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