0
  • My project is open sourced, except for a single module where I don't want people to know the implementation. Actually, I don't mind one or two people cracking the thing open if they are determined enough, but I want most to give up at the first sight.
  • I only want the implementation of that single module to be hidden, the interface still fully usable if people want to contribute to the project. That is to say, I want people to be able to do things like:
import my_hidden_module

my_hidden_module.do_stuff()
  • My project mostly runs on Windows so Windows-exclusive suggestions are ok.
  • I'm totally new to this hiding code thing so I don't know where to start. It would be appreciated if someone could give me a direction to look into.
Koko191
  • 58
  • 5

1 Answers1

0

1) You can use classes and private variables or 2) use name =='main', but that will not implement the code on interface 3) looks dumb but you can comment on top of that function to not to be CHANGED else you can see - How do I protect Python code?

Anshul
  • 1,495
  • 9
  • 17