1

Possible Duplicate:
How do I protect python code?

How do I hide my python code, I don't want the code to be available to everyone to see.

I know python is interpreted, but is there a way, tool .. etc to allow someone to use the software without being able to see the code?

Community
  • 1
  • 1
Darth Plagueis
  • 910
  • 3
  • 21
  • 39

4 Answers4

8

You can reduce it to pyc files, but that's not really like full compilation. Python isn't really designed to be able to 'hide' code. The only way to fully hide implementation details that I know of is to deploy all your core logic on a server and expose it as services to your distributed app.

Silas Ray
  • 25,682
  • 5
  • 48
  • 63
3

Maybe Pyrex might help you. It is a python to C compiler ; it is intended to let you make modules available to python. That way, you could choose what to hide from the user (as it would be in an opaque module) and what to show.

Fabien
  • 12,486
  • 9
  • 44
  • 62
0

You could probably (after talking with some lawyers) plaster your code with license info (legally) preventing 3rd parties from using your code in ways that you don't want...but as other have said, if the user can run your code on their machines, they can "see" it (if they're determined enough at least) -- even if bundled in an exe or in pyc files...

mgilson
  • 300,191
  • 65
  • 633
  • 696
-1

Compile it and/or create an executable file with it?

http://www.py2exe.org/

adchilds
  • 963
  • 2
  • 9
  • 22
  • It won't help. User can still unzip the exe and get the code. – Simon Bergot Jun 20 '12 at 14:30
  • I was just thinking more for the average user who doesn't know how to do so. More often than not the end user won't know such or care. – adchilds Jun 20 '12 at 14:31
  • The average user never cares. Usually you want to protect yourself against people who have at least some motivation. Python does not allow this level of protection. You have to use legal protection and offer a service which useful and complex enough for people to pay you for the support. If stealing you costs more than paying you, then you win. – Simon Bergot Jun 20 '12 at 14:36