Skip to main content

wcpan.watchdog

An asynchronous watchdog utility built with asyncio.

Installation

pip install wcpan.watchdog

Command Line Usage

You can simply use the main module like this:

python3 -m wcpan.watchdog -- <any command>

It will restart the command (if it is still running) for every file changed.

Library Usage

You can also use this in your code:

import asyncio
import signal

from wcpan.watchdog.watcher import Watcher

async def auto_rerun():
    path = 'the path you want to observe'

    # Setup how to stop the watcher.
    # In this example I use SIGINT to set the Event.
    loop = asyncio.get_running_loop()
    stop_event = asyncio.Event()
    loop.add_signal_handler(signal.SIGINT, lambda: stop_event.set())

    async with Watcher() as watcher:
        # This will not stop until stop_event is set.
        async for changes in watcher(path, stop_event=stop_event):
            # Changes contains changed information.

Release files for wcpan-watchdog 1.3.1

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

Source distribution (sdist)

Source distribution for wcpan-watchdog 1.3.1
File Size Uploaded
wcpan_watchdog-1.3.1.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wcpan-watchdog 1.3.1
File Interpreter ABI Platform
wcpan_watchdog-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size:14.6 kB

Release files / wcpan_watchdog-1.3.1.tar.gz

Download URL wcpan_watchdog-1.3.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a5e0da3c939632e76b69eb2f5189d9bb1aeaea553aca67ecbe02e2ae865ff200
BLAKE2b-256 checksum
How to use checksums
1bf7ac98d10db54387b8b7936ba58d2fb92976e467d6a9b5613c7c600ca1fdb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

Release files / wcpan_watchdog-1.3.1-py3-none-any.whl

Download URL wcpan_watchdog-1.3.1-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1310e7af2608e727799a0528530519832b506269e1cc91a22ec512d08d90ba40
BLAKE2b-256 checksum
How to use checksums
6fcededa93dfc68b5d027427d6b2e3ad60c34e888df179757da99d1e423c01ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.11.2 Linux/5.15.167.4-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

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