ilead-cong / oneFace

Generating interfaces(CLI, Qt GUI, Dash web app) from a Python function.

Home Page:https://oneface.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oneFace is a Python library for automatically generating multiple interfaces(CLI, GUI, WebGUI) from a callable Python object.

Build Status codecov Documentation Install with PyPi

oneFace is an easy way to create interfaces in Python, just decorate your function and mark the type and range of the arguments:

from oneface import one, Arg

@one
def bmi(name: Arg(str),
        height: Arg(float, [100, 250]) = 160,
        weight: Arg(float, [0, 300]) = 50.0):
    BMI = weight / (height / 100) ** 2
    print(f"Hi {name}. Your BMI is: {BMI}")
    return BMI


# run cli
bmi.cli()
# or run qt_gui
bmi.qt_gui()
# or run dash web app
bmi.dash_app()

These code will generate the following interfaces:

CLI Qt Dash
CLI Qt Dash

Features

  • Generate CLI, Qt GUI, Dash Web app from a python function.
  • Automatically check the type and range of input parameters and pretty print them.
  • Easy extension of parameter types and GUI widgets.

Detail usage see the documentation.

Installation

To install oneFace with complete dependency:

$ pip install oneface[all]

Or install with just qt or dash dependency:

$ pip install oneface[qt]  # qt
$ pip install oneface[dash]  # dash

About

Generating interfaces(CLI, Qt GUI, Dash web app) from a Python function.

https://oneface.readthedocs.io/en/latest/

License:GNU General Public License v3.0


Languages

Language:Python 100.0%