Is it possible to protect python source code by compiling it to .pyc or .pyo?

Joshua Landau joshua at landau.ws
Fri Jan 17 16:31:18 EST 2014


On 17 January 2014 00:58, Sam <lightaiyee at gmail.com> wrote:
> I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates.
>
> Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection?

If you're worried about something akin to corporate espionage or
some-such, I don't know of a better way than ShedSkin or Cython. Both
of those will be far harder to snatch the source of. Cython will be
particularly easy to use as it is largely compatible with Python
codebases.

I offer no opinions, however, on whether this is a task worth doing. I
only suggest you consider the disadvantages and how they apply to your
individual case.



More information about the Python-list mailing list