Discussion:
[FE-discuss] Python 3 support
Christoph Zwerschke
2013-01-31 00:22:23 UTC
Permalink
What is the current state of Python 3 support
(https://github.com/formencode/formencode/issues/2),
is anybody working on it?

-- Christoph
Chris Lambacher
2013-01-31 04:11:05 UTC
Permalink
Hi Christoph,

After I put out the 1.2.5 release and created a branch for 1.2.x I started
playing around with doing a Python 3 port. I tried to do it
semi-automatically with python-modernize with the six and --compat-unicode
options. It didn't even close to work cleanly and I was trying to work out
how to get the meta class to work when I ran out of time. I've since seen
some code that works on 2 & 3 that does the same thing I was trying to get
to work so, I was on the right track. I *might* have some time in Feb to
pick up on this. But if someone else wants to take a run at it that would
be good. I didn't run the tests with the Python 3 warnings first so that
might be a good first step (i.e. convert "except Invalid, e" to "except
Invalid as e").

-Chris
Post by Christoph Zwerschke
What is the current state of Python 3 support
(https://github.com/formencode/formencode/issues/2),
is anybody working on it?
-- Christoph
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
FormEncode-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/formencode-discuss
--
Christopher Lambacher
***@kateandchris.net
Christoph Zwerschke
2013-01-31 21:23:01 UTC
Permalink
Post by Chris Lambacher
After I put out the 1.2.5 release and created a branch for 1.2.x I
started playing around with doing a Python 3 port. I tried to do it
semi-automatically with python-modernize with the six and
--compat-unicode options. It didn't even close to work cleanly and I
was trying to work out how to get the meta class to work when I ran
out of time. I've since seen some code that works on 2 & 3 that does
the same thing I was trying to get to work so, I was on the right
track. I *might* have some time in Feb to pick up on this. But if
someone else wants to take a run at it that would be good.
I've just checked in a different solution with the use_2to3 option of
Distribute, which creates a Python 3 version at build time.

Your solution using python-modernize to create a codebase that runs on
both versions with the help of six could be a better idea, though.

But the main difficulty we're facing is the semantics of the String and
Unicode validators under Python 3. Should we provide Bytes and String
validators under Python 3 instead? How can we create a documentation
that covers both versions of the validators with the automatic tools?
I'm wondering whether creating a separate formencode3 library for Python
3 could make more sense?

-- Christoph
Christoph Zwerschke
2013-02-01 12:05:42 UTC
Permalink
I have worked a bit more on the use_2to3 based solution and now all
tests (including the doctests) are running on Py 2.6, 2.7, 3.2 and 3.3.

The semantics of the String and UnicodeString validators is now a bit
different of course, and everything works under the assumption that the
"other" side is already decoded to strings in Python 3, not bytes.

-- Christoph

Loading...