Checking compatibility of a script across Python versionsautomatically

Discussion in 'Python' started by Andrew Berg, Jun 18, 2012.

  1. Andrew Berg

    Andrew Berg Guest

    Are there any tools out there that will parse a script and tell me if it
    is compatible with an arbitrary version of Python and highlight any
    incompatibilities? I need to check a few of my scripts that target 3.2
    to see if I can make them compatible with 3.0 and 3.1 if they aren't
    already. I found pyqver, but it isn't accurate (at least for 3.2/3.3
    scripts) and hasn't been updated in 2 years. I could look over the docs
    and do it manually, but one of the scripts isn't small, so I'd prefer
    not to.
    --
    CPython 3.3.0a4 | Windows NT 6.1.7601.17803
    Andrew Berg, Jun 18, 2012
    #1
    1. Advertising

  2. On Mon, 18 Jun 2012 14:24:03 -0500, Andrew Berg wrote:

    > Are there any tools out there that will parse a script and tell me if it
    > is compatible with an arbitrary version of Python and highlight any
    > incompatibilities? I need to check a few of my scripts that target 3.2
    > to see if I can make them compatible with 3.0 and 3.1 if they aren't
    > already. I found pyqver, but it isn't accurate (at least for 3.2/3.3
    > scripts) and hasn't been updated in 2 years. I could look over the docs
    > and do it manually, but one of the scripts isn't small, so I'd prefer
    > not to.


    You could try running it and see if it breaks. That usually works for
    me :)

    For anything except throw-away scripts, I prefer to write scripts with a
    "self-test" option so that I (or any other user) can run the test and see
    if it works without actually using it for production work.


    --
    Steven
    Steven D'Aprano, Jun 19, 2012
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Griz
    Replies:
    11
    Views:
    908
  2. Glenn
    Replies:
    0
    Views:
    423
    Glenn
    Aug 1, 2003
  3. Philip Semanchuk

    Binary compatibility across Python versions?

    Philip Semanchuk, Jul 26, 2010, in forum: Python
    Replies:
    0
    Views:
    210
    Philip Semanchuk
    Jul 26, 2010
  4. Terry Reedy
    Replies:
    0
    Views:
    223
    Terry Reedy
    Jun 19, 2012
  5. Stefan Behnel
    Replies:
    0
    Views:
    213
    Stefan Behnel
    Jun 19, 2012
Loading...

Share This Page