[Django] #28602: Filesystem watcher based autoreload implementation for Windows platform

67 views
Skip to first unread message

Django

unread,
Sep 16, 2017, 5:33:02 AM9/16/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------------------+----------------------------
Reporter: Adam Sowa | Owner: nobody
Type: Uncategorized | Status: new
Component: Utilities | Version: 1.11
Severity: Normal | Keywords: autoreload
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+----------------------------
Currently utils/autoreload.py has implementation for inotify based file
system watcher. On Windows it scans all files for changes every 1 second
which takes a lot of CPU. Windows provides file system watching API
(FindFirstChangeNotification) which does the same thing as inotify on
Linux. Django should take advantage of the API to make autoreloader more
efficient.

--
Ticket URL: <https://code.djangoproject.com/ticket/28602>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 16, 2017, 5:33:25 AM9/16/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-------------------------------+--------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: Uncategorized | Status: new
Component: Utilities | Version: 1.11
Severity: Normal | Resolution:

Keywords: autoreload | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Adam Sowa:

Old description:

> Currently utils/autoreload.py has implementation for inotify based file
> system watcher. On Windows it scans all files for changes every 1 second
> which takes a lot of CPU. Windows provides file system watching API
> (FindFirstChangeNotification) which does the same thing as inotify on
> Linux. Django should take advantage of the API to make autoreloader more
> efficient.

New description:

Currently utils/autoreload.py has implementation for inotify based file
system watcher. On Windows it scans all files for changes every 1 second
which takes a lot of CPU. Windows provides file system watching API
(FindFirstChangeNotification) which does the same thing as inotify on

Linux. Django should take advantage of the API to make autoreload more
efficient.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:1>

Django

unread,
Sep 28, 2017, 8:58:33 AM9/28/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11
Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/9093 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:2>

Django

unread,
Sep 29, 2017, 10:37:57 AM9/29/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11

Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------

Comment (by Tom):

This is similar to: https://code.djangoproject.com/ticket/27685

I've got a PR in that ticket (https://github.com/django/django/pull/8819)
to refactor the autoreloader and add support for the Watchdog library (and
watchman) over pyinotify, which handles the intricacies of Windows, Linux
and Mac file system notifications. IMO, after reading the Watchdog code
and seeing the rather tricky corner cases it handles (e.g
[[https://github.com/gorakhargosh/watchdog/blob/f1d32fd0e02cfbc727ae2b15f6eb9937959c3541/src/watchdog/observers/read_directory_changes.py#L85-L104|this]])
it would be best to outsource it there than maintain our own.

--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:3>

Django

unread,
Sep 29, 2017, 10:44:26 AM9/29/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11

Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tom):

* cc: Tom (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:4>

Django

unread,
Dec 13, 2017, 11:22:13 PM12/13/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11

Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tzu-ping Chung):

* cc: Tzu-ping Chung (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:5>

Django

unread,
Dec 30, 2017, 3:48:37 PM12/30/17
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11

Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:6>

Django

unread,
Jan 18, 2019, 5:17:58 PM1/18/19
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.11

Severity: Normal | Resolution:
Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------

Comment (by Tom Forbes):

I would consider closing this now
https://code.djangoproject.com/ticket/27685 is fixed, Watchman has beta
support for Windows platforms. Hopefully that will mature in the future,
so it seems redundant to duplicate work on a windows-specific reloader
implementation.

--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:7>

Django

unread,
Jan 18, 2019, 5:29:31 PM1/18/19
to django-...@googlegroups.com
#28602: Filesystem watcher based autoreload implementation for Windows platform
-----------------------------+------------------------------------

Reporter: Adam Sowa | Owner: nobody
Type: New feature | Status: closed
Component: Utilities | Version: 1.11
Severity: Normal | Resolution: wontfix

Keywords: autoreload | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => wontfix


Comment:

I'm not a Windows user but that sounds reasonable to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/28602#comment:8>

Reply all
Reply to author
Forward
0 new messages