Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Checking compatibility of a script across Python versions automatically

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


bahamutzero8825 at gmail

Jun 18, 2012, 12:24 PM

Post #1 of 4 (140 views)
Permalink
Checking compatibility of a script across Python versions automatically

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
--
http://mail.python.org/mailman/listinfo/python-list


tjreedy at udel

Jun 18, 2012, 6:44 PM

Post #2 of 4 (131 views)
Permalink
Re: Checking compatibility of a script across Python versions automatically [In reply to]

On 6/18/2012 3:24 PM, 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

Not that I know of.

> 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.

Forget about 3.0. Really. As for 3.1 versus 3.2, there were no core
syntax changes in 3.2. There were a few, but only a few, enhancements in
builtin classes. If you have a decent test suite, just run it under 3.1.



--
Terry Jan Reedy



--
http://mail.python.org/mailman/listinfo/python-list


stefan_ml at behnel

Jun 18, 2012, 11:00 PM

Post #3 of 4 (133 views)
Permalink
Re: Checking compatibility of a script across Python versions automatically [In reply to]

Andrew Berg, 18.06.2012 21:24:
> 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.

My advice: write a good test suite for your code and use something like tox
to run it under the various Python versions that you want to support. No
static analysis tool will ever be able to find all portability problems.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


steve+comp.lang.python at pearwood

Jun 19, 2012, 4:36 AM

Post #4 of 4 (134 views)
Permalink
Re: Checking compatibility of a script across Python versions automatically [In reply to]

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
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.