Skip to main content

Adds locks and timeouts to click entrypoints

Project description

Adds locks and timeouts to Click entrypoints.

There is only one decorator click_lock.lock which can be applied to click commands and groups:

# example.py
import time
import click
import click_lock

@click.command()
@click_lock.lock
def cmd():
    time.sleep(10)

cmd()

Now you have some additional options:

Usage: example.py [OPTIONS]

Options:
  --lock fname          Path to lock file
  --timeout seconds     Limit script execution time
  --trace / --no-trace  Log traceback in case of timeout  [default: True]
  --help                Show this message and exit.

For example, lock script execution:

python example.py --lock /tmp/example.lck

Limit script execution time:

python example.py --timeout 1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for click-lock, version 0.6
Filename, size File type Python version Upload date Hashes
Filename, size click-lock-0.6.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page