Changes between Version 1 and Version 2 of SummerOfCode2017


Ignore:
Timestamp:
Jan 27, 2017, 9:28:19 AM (7 years ago)
Author:
Aymeric Augustin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SummerOfCode2017

    v1 v2  
    150150
    151151While it is *possible* to work around this problem, it *should* be a well documented, easy to use capability.
     152
     153=== Improved autoreloader (#27685) ===
     154* '''Complexity:''' Medium
     155
     156Django's development server includes an auto-reloader. Its design is quite old. It keeps a list of imported Python files (as well as .mo files, there's a hardcoded special case), checks every second the mtime of these files, and triggers a reload if a file was updated. This cannot be good for battery life.
     157
     158A more efficient implementation based on inotify is available on Linux. An implementation based on kqueue was developed at some point but quickly removed because of kqueue limitations (#21621).
     159
     160Several open-source projects provide modern and robust building blocks for building the autoreload feature. The most mature in general is probably watchman. The most mature Python library is probably watchdog. However their APIs are quite low level and there's no trivial way to integrate them with Django's development server.
     161
     162The first goal of this project is to figure out and implement this integration. This means rebuilding the development server's autoreloading feature, perhaps with a slightly different behavior and hopefully with better performance, while preserving the main APIs (`runserver`, `runserver --no-reload`).
     163
     164It would make sense to switch from watching all imported Python files to watching the current directory. Modifying non-Python files whose content is somehow cached in the Python process happens and is regularly reported as a bug, while modifying files in `$VIRTUAL_ENV/lib/pythonX.Y/site-packages` is an uncommon case.
     165
     166It will be a good opportunity to fix various bugs of the autoreloader such as the inability to detect the addition of a file, typically an `admin.py`.
     167
     168The second goal is to improve configurability of the autoreloader, perhaps by exposing the underlying library's configuration knobs. This will allow people to customize the behavior according to their needs, for example if they want to go back to the previous behavior and watch `$VIRTUAL_ENV`.
Back to Top