title: Prevent python untrusted code from accessing file system and network
body: <p>I need to to execute python code commited by user on my server.
  The problem is that I need a several imports - numpy, pandas and a couple of functions from my source code. I am going to use <strong>heroku</strong>.</p>
  <p>How to do this in a proper way? I have tried <a href="https://pypi.org/project/RestrictedPython/" rel="nofollow noreferrer">https://pypi.org/project/RestrictedPython/</a>, but it still allowes methods like <code>numpy.save</code>, Pypy does not allow to import modules at all.</p>
  <p>I am thinking about two approaches:</p>
  <ol>
  <li>Create the separate process in python and restrict access to file system and network for this process. Could someone explain me is this possible at all?</li>
  <li>Run the separate heroku instance and communicate with it via rpc. Remote server will not have any dangerous files\env variables on it.</li>
  </ol>
  <p>Could you recommend any other options for me?</p>
  <p>One more point - I need to execute about 1000 functions per second. I cannot create a new docker container every time.</p>