Skip to main content

virgilio — a polling-based folder-watching daemon with an overridable hook interface.

Project description

Virgil.IO

Virgil.IO logo

CI License: MIT Python 3.10+ Typing: Typed GitHub tag GitHub last commit

A folder-watching daemon that detects file creations, modifications, and deletions, and notifies a consumer via overridable hook methods. Pure polling — no watchdog, no OS-native filesystem-event API — so behavior is consistent across macOS, Linux, and Windows.

CLI usage

virgilio <folder>

Watches only <folder>'s immediate contents by default, polling once per second, logging every event to log.txt inside <folder>.

Flags:

virgilio <folder> --recursive --interval 0.5 --include-hidden --report-existing
  • --recursive / -r — watch the full subtree instead of just <folder>'s immediate contents.
  • --interval SECONDS / -i SECONDS — poll interval in seconds (default 1.0), may be a float (e.g. 0.25).
  • --include-hidden — include hidden files/directories (dotfiles) and symlinks in the walk (excluded by default).
  • --report-existing — fire a FOUND event for every pre-existing file at startup, instead of silently indexing it.

If <folder> doesn't exist or isn't a directory, virgilio prints an error and exits with a non-zero status without starting.

Library usage

Subclass Virgilio and override whichever hooks you care about, then reuse the same argument parsing via .main() — no separate CLI-loading mechanism needed:

from virgilio import Virgilio, EventType

class MyVirgilio(Virgilio):
    def notify_created(self, path: str) -> None:
        print(f"new file: {path}")

    def notify(self, event: EventType, path: str) -> None:
        send_metric(event, path)

MyVirgilio.main()

MyVirgilio.main() parses sys.argv exactly like the plain virgilio CLI (<folder> [--recursive] [--interval SECONDS] [--include-hidden] [--report-existing]), constructs a MyVirgilio, and calls .run(...). Both notify (unified) and the event-specific hook (notify_created, notify_modified, notify_deleted, notify_found, notify_error) fire for every event — override either, both, or neither.

To embed a Virgilio inside a larger application (e.g. running .run() on its own thread), call .stop() to shut it down programmatically instead of relying on SIGINT/SIGTERM:

import threading

virgilio = MyVirgilio("/path/to/folder")
thread = threading.Thread(target=virgilio.run, kwargs={"recursive": True})
thread.start()
...
virgilio.stop()
thread.join()

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

virgilio-1.0.1.tar.gz (179.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

virgilio-1.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file virgilio-1.0.1.tar.gz.

File metadata

  • Download URL: virgilio-1.0.1.tar.gz
  • Upload date:
  • Size: 179.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for virgilio-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4e8de210458087314686bf1baba40b95c88f14a1c86c6e763f457eaef86122d2
MD5 20be961c9182f73979197842ef62c214
BLAKE2b-256 c68aa46f0bdc6a2a1baf85719a6bff135a2fbf24834fb21549d3131b8101b347

See more details on using hashes here.

File details

Details for the file virgilio-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: virgilio-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for virgilio-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3db75b91cea3f82172454b9faed0e9263bc50b76eede66bd0eb4bb59cad064e4
MD5 3a4c422c5b17c0275ae65626beafa5cd
BLAKE2b-256 3d9096d60ddc53786c55d50386d4dc40b0219c52c910e041715d01549c3d7936

See more details on using hashes here.

Supported by

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