Skip to content

Instantly share code, notes, and snippets.

@yano3nora
Last active May 17, 2023 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yano3nora/49bbe455ea8529f6276627a9391118c5 to your computer and use it in GitHub Desktop.
Save yano3nora/49bbe455ea8529f6276627a9391118c5 to your computer and use it in GitHub Desktop.
watchdog/watchmedo - Python file watcher like nodemon for Hot Reload. #python

Overview

pythonhosted.org/watchdog
github.com/gorakhargosh/watchdo

  • python の file watcher library
  • 付属の cli tool watchmedo で nodemon みたいなことできる
    • auto-restart コマンドを利用する感じ
  • 正直 watchdog 側は使うことなさそう

watchmedo

# install only watchmedo
$ python -m pip install "watchdog[watchmedo]"

# using like nodemon
#
# - current directory `.` の `*.py` を監視
# - ↑ 変更されたら `--` 以降を restart してくれる
#
$ watchmedo auto-restart -d . -p '*.py' -- python your_script.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment