Obscuring Python source from end users

Chris Angelico rosuav at gmail.com
Mon Sep 29 09:52:43 CEST 2014


On Mon, Sep 29, 2014 at 5:36 PM,  <norman.ives at gmail.com> wrote:
> I have a project that involves distributing Python code to users in an organisation. Users do not interact directly with the Python code; they only know this project as an Excel add-in.
>
> Now, internal audit takes exception in some cases if users are able to see the source code.

The solution is to fix your internal audit. There's fundamentally no
way to hide the source code, and it's going to add complexity.
Demonstrate that it could take you a large number of man-hours and
achieve little, and just declare that the source code IS what you
want.

Alternatively, you could do a source-level reformat that crunches
everything down as much as possible, while still producing
syntactically-identical source code. Remove all the comments, shorten
local names to one letter, etc. That would result in something that,
while still perfectly executable, won't be nearly as helpful. It
wouldn't be nice readable source code, at least. Would your audit be
satisfied with that?

ChrisA



More information about the Python-list mailing list