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

Project details


Download files

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

Source Distribution

click-lock-0.6.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file click-lock-0.6.tar.gz.

File metadata

  • Download URL: click-lock-0.6.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for click-lock-0.6.tar.gz
Algorithm Hash digest
SHA256 816c413166ffbbd2222a2070e3d30d60c81666a4b2319e19d72e52d424729ab2
MD5 34226ee5003d14b48707b744701c0fdd
BLAKE2b-256 22b1a928b2bd706996fa32f158f34738799ce62cacbe9922a8a417acc12a4aa8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page