librelist archives

« back to archive

Running Python-Omega on Python 2.6.1

Running Python-Omega on Python 2.6.1

From:
John Pallister
Date:
2014-12-16 @ 01:10
Hi Tim,

Firstly, I must say that Omega looks great, particularly the fantastic
documentation. Thanks for putting it all together!

I came across Omega while looking for a Python implementation of OMeta, but
I only found it by searching the OMeta mailing list for "Python" - it's not
very well publicised. Google showed me PyMeta (as did the OMeta page), but
the complete lack of documentation was off-putting, to say the least.

I've been interested in OMeta for a while (and I've started my own Common
Lisp version, based on Tony Garnock-Jones's Scheme implementation) but
haven't tried to use it in anger until now. A client needs some HTML
munged, and they're OK running a Python script, but they only have Python
2.6.1 on OS X 10.6.8 at the moment. So I'd like to use Omega, and I have
Python 2.7.8, but I wanted to ask you whether you could definitely say
Omega wouldn't run on Python 2.6 before I start installing old versions for
testing.

If you think it might work I'll forge ahead and try it out; if it
definitely won't I'll have to ask the client to upgrade their local Python
(which hopefully won't be a big deal).

I'm looking forward to getting stuck in to some parsing with Omega! Are you
still using it much yourself?

Thanks again,

John :^P
-- 
John Pallister
john@johnp.net
john@synchromesh.com

Re: [python.omega] Running Python-Omega on Python 2.6.1

From:
Tim Allen
Date:
2014-12-19 @ 07:33
On Tue, Dec 16, 2014 at 01:10:52AM +0000, John Pallister wrote:
> I've been interested in OMeta for a while (and I've started my own
> Common Lisp version, based on Tony Garnock-Jones's Scheme
> implementation) but haven't tried to use it in anger until now.
> A client needs some HTML munged, and they're OK running a Python
> script, but they only have Python 2.6.1 on OS X 10.6.8 at the moment.
> So I'd like to use Omega, and I have Python 2.7.8, but I wanted to ask
> you whether you could definitely say Omega wouldn't run on Python 2.6
> before I start installing old versions for testing.

Omega's biggest issue with portability between Python versions is likely
to be the `ast` standard library module; for example, Python 3.x
supports annotations on function arguments, so when I ported Omega to
Python 3.x I had to fix the code that defined function to pass None for
all the annotations.

The first version of Omega was written with Python 2.7, and I don't
recall *deliberately* making it incompatible with Python 2.6, but
I can't imagine the `ast` module can have changed very much between the
two.

Omega has a pretty decent test suite; try running it on Python 2.6 and
see what happens. :)

> If you think it might work I'll forge ahead and try it out; if it
> definitely won't I'll have to ask the client to upgrade their local
> Python (which hopefully won't be a big deal).

I have to admit, for the specific case of HTML munging I'm hesitant to
suggest writing a custom parser; the contortions browsers go through to
handle real-world HTML are scary. It would be much more practical to use
something like html5lib, which is a pure-Python implementation of the
standard browser parsing algorithm.

> I'm looking forward to getting stuck in to some parsing with Omega!
> Are you still using it much yourself?

I must admit, I haven't really used it 'in anger' yet. When I read about
the OMeta language, I was amazed at how easy it was to express complex
grammars, and I wanted to make sure such an elegant design was properly
available in Python. Having written Omega and all the documentation,
I decided to take a break and got distracted by other things. I'm still
pretty proud of it, though!