0

I have a project that allows users to their python files on an environment. For safety purpose, the environment is done by PyPy's sandbox.

I also have some library code for users to use. However, I don't want them to see the source code.

Is there a way to be able to import the module, but not be able to see the module content?

Thanks!

yonexer
  • 43
  • 1
  • 3

1 Answers1

0

There are probably some hacky ways to do this. One I can think of off the top of my head is to edit the pypy sandbox script (the one that is trusted and actually accesses the files) to only read your module's file the first time, where it is (hopefully) being imported, and block reads after that. Keep in mind, however that they will be able to inspect the contents of the module, and probably be able to determine a lot about the code.

Aereaux
  • 845
  • 1
  • 8
  • 20