Serve click scripts over the web with minimal effort.
Project description
click-web
Serve click scripts over the web with minimal effort.
Caution: No security (login etc.), do not serve scripts publicly.
usage
Take an existing click script, like this one:
test_command.py
import click import time @click.group() def cli(): 'A stupid script to test click-web' pass @cli.command() @click.option("--delay", type=float, default=0.01, help='delay for every line print') @click.argument("lines", default=10, type=int) def print_rows(lines, delay): 'Prints lines with a delay' click.echo(f"writing: {lines} with {delay}") for i in range(lines): click.echo("hejsan rad: {}".format(i)) time.sleep(delay) if __name__ == '__main__': cli()
Create a minimal script to run with flask
app.py
from click_web import create_click_web_app from example import example_command app = create_click_web_app(example_command, example_command.cli)
Running example app:
In Bash:
export FLASK_ENV=development export FLASK_APP=app.py flask run
Unsupported click features
It has only been tested with basic click features, and most advanced features will probably not work.
- Variadic Arguments (will need some JS on client side)
- Promts (probably never will)
- Custom ParamTypes (depending on implementation)
TODO
- Abort started/running processes.
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size click_web-0.5.0-py3-none-any.whl (26.5 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size click-web-0.5.0.tar.gz (22.2 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for click_web-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c68484306be7f143e74d5afcb50a7b207b06348dce0c95dea54ede9155d5cc5 |
|
MD5 | e66afd4439f980adc72391bc79e3afa7 |
|
BLAKE2-256 | 5b449e4aed1e7f1df7cde379293bb432afe8284199cbc64d52ca1622fea1410b |