Skip to content

fix: respect false-like env flags#366

Closed
Bojun-Vvibe wants to merge 1 commit intosamuelcolvin:mainfrom
Bojun-Vvibe:agent/samuelcolvin_watchfiles-1776715104
Closed

fix: respect false-like env flags#366
Bojun-Vvibe wants to merge 1 commit intosamuelcolvin:mainfrom
Bojun-Vvibe:agent/samuelcolvin_watchfiles-1776715104

Conversation

@Bojun-Vvibe
Copy link
Copy Markdown

Repo: samuelcolvin/watchfiles (⭐ 2000)
Type: bugfix
Files changed: 3
Lines: +46/-5

What

This change makes WATCHFILES_DEBUG and WATCHFILES_IGNORE_PERMISSION_DENIED treat explicit false-like values consistently. Instead of enabling those flags for any non-empty string, false, disable, and disabled now correctly resolve to False, and the new tests cover those cases alongside the existing truthy and unset behavior.

Why

Before this patch, setting WATCHFILES_DEBUG=false or WATCHFILES_IGNORE_PERMISSION_DENIED=false still enabled the option because Python treated any non-empty environment variable as truthy. That is surprising for users trying to disable those flags in shell or container environments, and it was inconsistent with WATCHFILES_FORCE_POLLING, which already recognized false-like strings.

Testing

Committed focused test coverage for the new env-var cases in tests/test_force_polling.py and tests/test_rust_notify.py. A direct Python sanity check confirmed the changed helper behavior for unset, empty, 1, false, disable, and disabled values. Targeted pytest execution was attempted, but the host environment injects external pytest plugins that fail before repo tests run.

Risk

Low / narrow change to env-var parsing for two boolean helpers, with matching regression coverage added.

@Bojun-Vvibe Bojun-Vvibe closed this by deleting the head repository Apr 21, 2026
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