2. Use concurrent.interpreters instead of custom wrappers

In Python 3.14 and later, use concurrent.interpreters rather than building your own thin wrapper around low-level subinterpreter management.

Using the standard abstraction makes the concurrency model more legible and avoids coupling your code to private mechanisms that may change. It also lowers the amount of wrapper code your team has to debug and explain.

Note

Python 3.14+

2.1. Don’t do this

1# custom wrapper around private or low-level interpreter management
2worker = start_subinterpreter()
3worker.run('print("hello")')

2.2. Do this

1from concurrent import interpreters
2
3interp = interpreters.create()
4interp.exec('print("hello")')