process_isolation 0.13 -- per-module process isolation in pure python

Alex Flint alex.flint at gmail.com
Mon Dec 2 05:38:33 CET 2013


Hi all,

I'm happy to announce the release of process_isolation, a library for
running python modules in sub-processes while iteracting with them
like normal modules.

    https://github.com/alexflint/process-isolation

What is process_isolation?
==========================

Process isolation creates sub-processes and imports python modules
into them, then provides proxies so that interacting with those
modules looks like interacting with ordinary modules:

    from process_isolation import import_isolated
    sys = import_isolated('sys')
    sys.stdout.write('Hello world\n')  # runs in a sub-process

This is particularly useful for testing extension modules because
segfaults and other operating system-level signals can be caught as
ordinary exceptions:

    buggy_ext_module = import_isolated('buggy_ext_module')
    try:
        buggy_ext_module.this_might_segfault()
    except ProcessTerminationError as ex:
        print 'There be dragons!'

It can also be used to safely run untrusted code, and to solve the
reload problem for extension modules. Process isolation is implemented
in pure python.

All feedback appreciated.

Alex


More information about the Python-announce-list mailing list