execnb
execnb copied to clipboard
Daemon mode to speed up startup
There've been ongoing discussions in various channels about adding a daemon mode to execnb. Although this is probably a longer-term thing, I thought an issue could be a good place to store useful notes and important decisions made along the way.
What is a daemon mode?
@jph00's thread sums it up well:
Python scripts can be slow to start because the imports can take a long time. I have lots of scripts that read/write stdin/out. I'd like to replace them with something with identical behavior, but which behind the scenes auto-launches a little server. [...] The idea is that the overhead of starting the script only happens once. This is useful for stuff like git hook scripts.
References
- PEP 3143 – Standard daemon process library
python-daemon: reference implementation for PEP 3143- Rules that daemons are meant to follow
daemonize: a library for writing system daemons in Python (unmaintained)- Discussion on a daemon mode for Python
cc @hamelsmu