[Django] #32534: Allow using StatReloader even if watchman is available

20 views
Skip to first unread message

Django

unread,
Mar 10, 2021, 9:40:16 AM3/10/21
to django-...@googlegroups.com
#32534: Allow using StatReloader even if watchman is available
-------------------------------------------+------------------------
Reporter: Evgeny Arshinov | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: dev
Severity: Normal | Keywords: reload
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
Hi,

Currently if Django discovers a compatible version of `watchman`, it
unconditionally used WatchmanReloader instead of StatReloader. There is
reason to do that because normally WatchmanReloader performs just as
reliably as StatReloader while being more efficient. However, in my setup,
which is WSL 2 + Docker with project dir mounted from Windows filesystem,
watchman simply doesn't work because of non-functioning inotify. This lack
of inotify support on WSL's part isn't clearly documented, but there are
two issues WSL project members usually reference:
- https://github.com/microsoft/WSL/issues/4064
- https://github.com/microsoft/WSL/issues/4739

WSL people strongly recommend placing files to be mounted into Docker on
the WSL filesystem (rather than Windows filesystem), but I have to keep
them in Windows filesystem due to other issues in my development
infrastructure. Not all of our development team members have to do that,
so I can't exclude watchman from our development Docker image altogether
which would ruin the autoreload experience for others.

What I suggest is an environment variable like `DJANGO_WATCHMAN_ENABLE(D)`
/ `DJANGO_WATCHMAN_DISABLE(D)` which would allow me to turn off watchman
support without altering the Docker image.

References:
- Watchman support in django.utils.autoreload:
https://code.djangoproject.com/ticket/27685
- [https://docs.djangoproject.com/en/3.1/ref/django-admin/#envvar-
DJANGO_WATCHMAN_TIMEOUT DJANGO_WATCHMAN_TIMEOUT] - an existing watchman
configuration option to be defined as an env var

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

Django

unread,
Mar 11, 2021, 1:25:52 AM3/11/21
to django-...@googlegroups.com
#32534: Allow using StatReloader even if watchman is available
---------------------------------+--------------------------------------

Reporter: Evgeny Arshinov | Owner: nobody
Type: New feature | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: wontfix

Keywords: reload | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

Thanks for the suggestion, however it's really niche. Also, both
`Watchman` and `pywatchman` is required so you should be able to provide
an virtual environment on your docker image without `pywatchman`
installed. I don't think there is any workaround needed in Django itself.

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

Django

unread,
Mar 11, 2021, 9:04:40 AM3/11/21
to django-...@googlegroups.com
#32534: Allow using StatReloader even if watchman is available
---------------------------------+--------------------------------------

Reporter: Evgeny Arshinov | Owner: nobody
Type: New feature | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: wontfix

Keywords: reload | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Evgeny Arshinov):

I would like to share Docker image with my colleagues. Having a dedicated
image would bring me a lot of pain because Dockerfiles have almost no
support for composition and overriding.

I agree that this issue is niche, but fixing it would only cost ≈2 lines
of code on Django's side (+ some documentation and tests, of course). I am
ready to submit a pull request and work on it if it helps. It would still
be easier than having my own Docker image or hacking Django reload in some
way.

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

Django

unread,
Mar 11, 2021, 11:48:47 AM3/11/21
to django-...@googlegroups.com
#32534: Allow using StatReloader even if watchman is available
---------------------------------+--------------------------------------

Reporter: Evgeny Arshinov | Owner: nobody
Type: New feature | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: wontfix

Keywords: reload | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:2 Evgeny Arshinov]:


> I agree that this issue is niche, but fixing it would only cost ≈2 lines
of code on Django's side (+ some documentation and tests, of course). I am
ready to submit a pull request and work on it if it helps. It would still
be easier than having my own Docker image or hacking Django reload in some
way.

I'm sorry but we cannot add features for every users just because they are
not complex (''"death by a thousand cuts"''). It's not clear for me why
you cannot use a different virtual environment on the same docker image.
You can try to use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels].

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

Django

unread,
Mar 11, 2021, 11:49:51 AM3/11/21
to django-...@googlegroups.com
#32534: Allow using StatReloader even if watchman is available
---------------------------------+--------------------------------------

Reporter: Evgeny Arshinov | Owner: nobody
Type: New feature | Status: closed
Component: Utilities | Version: dev
Severity: Normal | Resolution: wontfix

Keywords: reload | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Evgeny Arshinov):

This is understandable. Thanks for your reply!

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

Reply all
Reply to author
Forward
0 new messages