Indeed, we have an implementation of this specific to mypy.

On Fri, May 11, 2018 at 11:34 AM, Antoine Pitrou <solipsis@pitrou.net> wrote:

Yes, you don't want this to be a generic utility, rather a helper
library that people can integrate into their command-line applications
to enable such startup caching.

Regards

Antoine.


On Fri, 11 May 2018 17:27:35 +0200
Oleg Broytman <phd@phdru.name> wrote:
> On Fri, May 11, 2018 at 07:38:05AM -0700, Chris Barker - NOAA Federal via Python-Dev <python-dev@python.org> wrote:
> > Could one make a little startup utility that, when invoked the first
> > time, starts up a raw python interpreter, keeps it running somewhere,
> > and then forks it to run the actual python code.
> >
> > Then every invocation after that would make a new fork. 
>
>    Used to be implemented (and discussed in this list) many times. Just
> a few examples:
>
> http://readyexec.sourceforge.net/
> https://blogs.gnome.org/johan/2007/01/18/introducing-python-launcher/
>
>    Proven to be hard and never gain any traction.
>
> a) you don't want the daemon to import all possible modules so you need
>    to run a separate copy of the daemon for every Python version, every
>    user and every client program;
> b) you need to find "your" daemon - using TCP? unix sockets? named pipes?
> b) need to redirect stdio to/from the daemon;
> c) need to redirect signals and exceptions;
> d) have problems with elevated privileges (how do you elevate the daemon
>    if the client was started with `sudo -H`?);
> e) not portable (there is a popular GUI that cannot fork).
>
> > -CHB
> > Sent from my iPhone 
>
> Oleg.






--
--Guido van Rossum (python.org/~guido)