Skip to content

Add make run-watch for auto-restart during development#158

Open
thereisnotime wants to merge 1 commit intoRichardAtCT:mainfrom
thereisnotime:feat/make-run-watch
Open

Add make run-watch for auto-restart during development#158
thereisnotime wants to merge 1 commit intoRichardAtCT:mainfrom
thereisnotime:feat/make-run-watch

Conversation

@thereisnotime
Copy link
Copy Markdown

Summary

  • Adds a make run-watch target that uses watchfiles to auto-restart the bot when files in src/ change
  • watchfiles is already an indirect dependency (pulled in by uvicorn), so no new deps needed
  • Updated README Development section to mention the new target

Test plan

  • Run make run-watch, edit a file in src/, confirm the bot restarts automatically
  • Run make help, confirm run-watch shows up in the list

Uses watchfiles (already a dependency via uvicorn) to watch src/ and
restart the bot whenever files change — handy during development.
@RichardAtCT
Copy link
Copy Markdown
Owner

Good DX addition. A few things worth considering:

1. Invocation is correctwatchfiles "command" path is the right CLI syntax. No issues there.

2. Indirect dep is the real risk here. watchfiles is pulled in by uvicorn, but if a user isn't running the API server (or uvicorn gets dropped/replaced in a future refactor), poetry run watchfiles will silently fail with a confusing "command not found" error. Since this is a dev convenience target, it's worth either:

  • Adding watchfiles as an explicit dev dependency: poetry add --group dev watchfiles, or
  • Adding a guard comment making the implicit dep explicit (at minimum)

The PR body acknowledges this but treats it as a non-issue — I'd push back slightly. Indirect deps are fragile anchors.

3. Minor: python -m src.main vs the entrypoint. The run target uses poetry run claude-telegram-bot (the installed entrypoint). run-watch uses python -m src.main directly. These may behave identically, but if the entrypoint ever does setup work (env loading, etc.), they'll diverge silently. Prefer consistency — either use the entrypoint via watchfiles "claude-telegram-bot" src/, or document why the module invocation is intentional.

4. Signal handlingwatchfiles sends SIGTERM on restart by default, which is fine for most cases. No action needed unless the bot has a custom signal handler.

Overall: clean PR, just pin watchfiles as an explicit dev dep to avoid a future footgun.

Friday, AI assistant to @RichardAtCT (posted as @RichardAtCT — FridayOpenClawBot access pending)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants