Skip to content

pauleveritt/pyramid_watcher

Repository files navigation

pyramid_watcher

Documentation Status

Want to watch your local files and take actions, including reloading a browser, when add/edit/change modifications are detected? pyramid_watcher works in a background thread and lets you register handlers.

This package is written specifically as a start to a static-site generator which watches Markdown files.

Docs

Docs for pyramid_watcher are hosted on ReadTheDocs.

Scanning

This package uses Python's builtin scandir module from PEP 471 and thus requires Python 3.5 or higher. As noted by Samuel Colvin in the README for watchgod, this approach is plenty fast and mitigates the need to use OS-native filesystem watching.

Acknowledgements

The world of JavaScript has tons of tools like webpack-dev-server which watch for changes and go through rich pipelines to then do interesting reload operations in the browser.

Hsiaoming Yang (lepture) manages a livereload package which does much of this. I wanted a few differences: integration with Pyramid in a rich way, higher-performance watching, and batch operations.

Samuel Colvin's watchgod was the architectural inspiration. The scandir approach and code was taken directly from his watchers.py file. His package does more things and is dependent on asyncio stuff.

Michael Merickel's hupper gave me the background thread approach registered with Pyramid. Far more importantly, Michael coached me through the entirety of writing this.

About

Watch a directory in Pyramid and register callbacks for handling files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published