Skip to main content

click-web

Serve click scripts over the web with minimal effort.

Example screenshot

Usage

See this demo screen capture.

Take an existing click script, like this one:

example_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):
    'Print lines with a delay'
    click.echo(f"writing: {lines} with {delay}")
    for i in range(lines):
        click.echo(f"Hello row: {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
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

Caution: If you plan to serve publicly make sure you setup security (SSL, login etc.) See Authentication

Authentication

For an example of how to secure using http digest auth see the auth example.

Note: There is no permission system and all logged in users can access everything. If you plan to deploy in an open environment make sure to setup HTTPS.

Custom Styling

For an example of how to customize styling using CSS and add extra page head or footer see the custom example.

Unsupported click features

It has only been tested with basic click features, and most advanced features will probably not work.

  • Variadic arguments of file and path type

  • Promts (probably never will)

  • Custom ParamTypes (depending on implementation)

TODO

  • Abort started/running processes.

  • Browser history

Included 3:rd party libraries

SplitJs - Copyright (c) 2020 Nathan Cahill (MIT license)

Metadata

Release files for click-web 0.8.6

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

Source distribution (sdist)

Source distribution for click-web 0.8.6
File Size Uploaded
click_web-0.8.6.tar.gz 40.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for click-web 0.8.6
File Interpreter ABI Platform
click_web-0.8.6-py3-none-any.whl Python 3 none any Details

Total release size: 85.6 kB

Release files / click_web-0.8.6.tar.gz

Download URL click_web-0.8.6.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7330aba64e8cb7f17e8e47d911a6b15cefc88530133166c14a4f1ca53f567352
BLAKE2b-256 checksum
How to use checksums
71bd1d969518549b2da53c50ed11071ff6c7d3aa44f433662d53c7da9579369b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / click_web-0.8.6-py3-none-any.whl

Download URL click_web-0.8.6-py3-none-any.whl
Size 45.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44f072bd54ca70a0bae2b8b5657042dd021fb481b200ce061f5bef4a995df8ee
BLAKE2b-256 checksum
How to use checksums
452b3b23cee9059b3ff21b0ade2ca710991b25ab54ea05a25491fbccb76b0796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.8.6 This release

2 release files

0.8.5

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

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.1

2 release files

0.5.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