Scott Ramey writes:
> Is there any way to protect the source code? At the least, > can extracting the source code be made "difficult" (aka, keep > honest people honest, while thieves will continue to steal).
The attitude of most Python developers is for open source code, however there are things that you can do to provide the type of protection you are after.
1) pyc files.
When you import a module, Python will look for both the .py file as well as the .pyc, which is a compiled Python script. It will recompile the .pyc if it deems that necessary. It will then use the .pyc and ignore the .py file. If the .pyc file exists and the .py does not, it simply uses the .pyc.
So, if you just distribute the .pyc files instead of the .py files, you have simple protection. Easy to reverse-engineer, but it will keep casual amateur would-be crackers away.
2) py2exe.
Packagers exist to make exe files (Windows executables) from your Python source. A would-be cracker would have to extract the files from the exe first. Only package .pyc files and they'd also have to reverse-engineer.
3) make a web service and don't publish the source.
...
Other ideas and methods I'm sure are abundant.
-- Paul
©2003 Paul McNett |