protecting the python code.

Discussion in 'Python' started by nell, Jan 16, 2005.

  1. nell

    nell Guest

    Hi all,
    I've developed a testing application in python, and should supply it in
    a way that no one (lets say they are regular users) will understand it
    and edit it.
    The application source is all python but we expose a UI written in C#
    that go over all our code and expose to user functions (Indicated with
    a special prefix).
    So the problem on one hand is protecting the source and make it less
    accessible ond on the other hand to make it available for the UI.
    10x in advance
    nell, Jan 16, 2005
    1. Advertisements

  2. nell

    Steve Holden Guest

    Before I spend *any* time explaining why this is probably a bad idea,
    not to mention impossible, I'd need to be convinced that your code is
    worth protecting in the first place :)

    Why is *your* code so much more valuable than any other commercial
    Python code currently distributed in non-obfuscated form?

    Paranoia can be taken too far.

    What does "10x in advance" mean?

    Steve Holden, Jan 16, 2005
    1. Advertisements

  3. nell

    nell Guest

    Hi Steve,
    First the "10x in advance" means thanks in advance.
    The main importance of protecting my code is to save headache of
    customers that want to be smart and change it and then complain on bugs
    and problems.

    nell, Jan 16, 2005
  4. nell

    Bob Smith Guest

    I'd say that's more of a policy issue than a technical issue. You have a
    contract or agreement with your customers, right? Just place a cluase in
    it that addresses your concerns. You don't have to support people who
    have altered your code... nor should they expect to be supported.
    Bob Smith, Jan 16, 2005
  5. nell

    Steve Holden Guest

    I'd have understood "tnx", never seens 10x b4 :)

    Your concerns are what licensing's for. ("No support on modified copies"
    would be a good heading for a section addressing this issue).

    With good enough release controls you can verify the code is unmodified
    using md5 checksums or similar.

    If a customer's good enough at Python to disassemble your .pyc files,
    they will probably tell you they've modified your code when the support
    queries come in :)

    Steve Holden, Jan 16, 2005
  6. also you can try to use py2exe
    Andrey Tatarinov, Jan 17, 2005
  7. nell

    A.B., Khalid Guest

    You basically have two options:

    1. Use Pyrex to compile your application to be used as (a) module(s).
    2. Use Pyrex to compile your application and embed Python in it.

    The first option is probably the easier of the two, and it only
    requires that you install Pyrex
    ( and that you
    study the Docs and the Demos in their respective directories.

    The second option is more involved but is still possible. You need to
    follow this:

    Many people use Pyrex to write Python extensions only. But given the
    obvious absence of competitors to address the issue of the protecting
    of python code, for whatever reason, then I think it is safe to say
    that Pyrex is now in a unique position to address that issue as well.
    Please be kindly reminded that even py2exe-- although a great
    undertaking-- is not AFAIK currrently that protective of your code--
    not that it ever claimed it is so-- as draging the resulting exe file
    to your zip archiever will reveal the python code inside your exe file.
    And so in short: try the Pyrex way.

    A.B., Khalid, Jan 17, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.