How to achieve pyc only deployment for module in python3.6

Chris Angelico rosuav at gmail.com
Tue Oct 2 01:41:02 EDT 2018


On Tue, Oct 2, 2018 at 12:01 PM Chandana Pattanayak
<chandana.pattanayak at patterneffectslabs.com> wrote:
>
> Hi,
>
> I have a requirement to provide basic code protection for a module in our
> product suite. With python 3.6 the .pyc files are created under pycache ,
> so if i remove the py file the module is not found anymore.

If you want code protection, the ONLY reliable way to do it is to not
provide the code *at all*, in any form. That generally means hosting
your application on some sort of server and granting access that way
(eg through a web browser interface). Shipping only .pyc files does
not protect your code - it merely obscures it a little.

I suggest changing the requirement. Otherwise, you're running a huge
risk that someone will decompile your pyc files, word will get back to
your company, and you'll get in trouble for having deceived people
into thinking that the code was protected when it actually wasn't.

ChrisA



More information about the Python-list mailing list