Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.06; 'distributing': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'cc:name:python list': 0.16; 'easier.': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'exception': 0.16; 'wrote:': 0.18; '(not': 0.18; 'code.': 0.18; 'rules': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'software.': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'distribute': 0.26; 'excel': 0.26; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'usually': 0.31; 'bad.': 0.31; 'clever': 0.31; "d'aprano": 0.31; 'sep': 0.31; 'steven': 0.31; 'subject:end': 0.31; 'subject:users': 0.31; 'yes.': 0.31; 'anyone': 0.31; 'probably': 0.32; 'option': 0.32; 'another': 0.32; 'cases': 0.33; 'skip:_ 10': 0.34; 'subject:from': 0.34; 'case,': 0.35; 'convert': 0.35; 'done.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'interact': 0.36; 'should': 0.36; 'list': 0.37; 'project': 0.37; 'files': 0.38; 'bad': 0.39; 'users': 0.40; 'simply': 0.61; 'companies': 0.62; 'email addr:gmail.com': 0.63; 'worth': 0.66; '3.4': 0.84; 'acquiring': 0.84; 'actually,': 0.84; 'subject:source': 0.84; 'audit': 0.93; 'suffer': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=twnEs50bvzEsNDvkS26j+DXjIluSdNLIdR9JHZefct8=; b=z5YihzZqDBaMCw85j8r5IHhIkgGqwHItWCa82AkeHT/RNpookU3gX3JBkFDvl1dUgf hJovJglrR61JuE7L2957zAc/w1bIRCBO8MCWt5xC2XriqBYmybixLtMbLrezCYjFviiu gSeYaqFwY4EHKxp9DSPPS2Pja6Rw5W42XpVMyHfg91wYezJA6xd1Ui6qT2Y4EuDiy/g8 JHIYmhfHhCWlcTrPOJwW7k597e5xI4INZxLQ3xzgu1UVjBz1pP38GWljYOL2hwC7Vq1D 2lm9ZsIITRimNisc0I8gtgfC4DVqSNH8od99keEWJZqM/pMPK9MEKfiIFB+6RPI8hk/a d32w== MIME-Version: 1.0 X-Received: by 10.112.9.234 with SMTP id d10mr20679855lbb.98.1412201160271; Wed, 01 Oct 2014 15:06:00 -0700 (PDT) In-Reply-To: <542946ec$0$12998$c3e8da3$5496439d@news.astraweb.com> References: <89381545-5edc-4f85-a4b8-86eebfdf34ee@googlegroups.com> <542946ec$0$12998$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 1 Oct 2014 15:06:00 -0700 Subject: Re: Obscuring Python source from end users From: Dan Stromberg To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412201168 news.xs4all.nl 2945 [2001:888:2000:d::a6]:36489 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78566 On Mon, Sep 29, 2014 at 4:47 AM, Steven D'Aprano wrote: > norman.ives@gmail.com wrote: > >> Hello list >> >> Python 3.4 applies. >> >> 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. > > You have my sympathy. Actually, I don't think this is that bad. Companies have rules; one simply has to learn to live with this or suffer greatly. Some rules are worth fighting, but this probably isn't one of them. >> So I'm wondering if anyone has clever suggestions in this regard... > > Yes. Distribute the pyc files only. Yes, this is the way it's usually done. Supposedly Microsoft did this for a while, after acquiring some Python software. In the Python 3.4 case, the pyc's should be in the __pycache__ subdirectory. Another option would be to convert to Cython and compile (not as bad as it sounds). But __pycache__/*.pyc would probably be easier.