Automatically generate a Web UI for Python function using type annotations.
Project description
Touch-Callable
The web framework for less serious application.
Automatically generate a Web UI for Python function using type annotations.
English | 简体中文
Support platforms
- macOS
- Ubuntu
- Windows
Installation
Only support Python 3.6!
pip install -U touch-callable
Supported parameter value types
- str
- int
- float
- bool
- datetime.datetime
- datetime.date
- datetime.time
- enum.Enum
- io.BytesIO
- typing.BinaryIO
Supported return value types
- All objects that can be
json.dumps
open('filename.xxx', 'rb')
, return values' annotation should beio.BufferedReader
CommandLine args
--host
Default is 127.0.0.1, you can only visit it on your computer.
If you want to listen all networks:
$ touch-callable example.py --host 0.0.0.0
--port
Default is 6789.
--debug
enable Flask debug feature(not recommend)
Default is False, if you want to enable it
$ touch-callable example.py --debug True
Screenshot
callables
Examples
All support types
# example.py
from datetime import datetime, date, time
from enum import Enum
import io
import typing
class Languages(Enum):
Python = 'Python'
PHP = 'PHP'
Java = 'Java'
def demo(int_: int, str_: str, float_: float, bool_: bool,
enum_: Languages,
datetime_: datetime = datetime.now(),
date_: date = date.today(),
time_: time = time(1, 2, 3),
bytes_io: io.BytesIO = None,
binary_io: typing.BinaryIO = None):
pass
$ touch-callable example.py
Return file
import io
def return_file() -> io.BufferedReader:
return open('filename', 'rb')
Stargazers
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
touch-callable-0.0.6.tar.gz
(1.8 MB
view hashes)
Built Distribution
Close
Hashes for touch_callable-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10979c53121ae1506e57e96ff962baa045c5ed9ea8c5cdd82e42055c89f0a7e3 |
|
MD5 | 203e91e4cb80f85fda6cf5d532cb901a |
|
BLAKE2b-256 | 6ad898a954a529a7bd99075bd8b4228be2c5d46476d327615159b2c91db25b1e |