Re: [pyxl] Python 3 port of xlwt

172 views
Skip to first unread message

Tony Roberts

unread,
May 12, 2013, 5:41:42 PM5/12/13
to python...@googlegroups.com
Hi Hans,

you might want to take a look at my pull request from the other day, or take a look at https://github.com/tonyroberts/xlwt. I've not tested as many features, but it's working well enough for what I need. I just thought I'd mention it as I chose to make as few changes as possible and use lib2to3 to do the rest (so you have to build it using setup.py in order for it to work). It doesn't use six so will work with python versions prior to 2.4 and has no other additional dependencies.

I'm happy for you to pick and chose anything you want from it, or ignore as you see fit.

cheers,
Tony

On Sun, May 12, 2013 at 5:06 PM, Hans Lawrenz <hrla...@gmail.com> wrote:
Hi,

A couple days ago I put in the beginnings of a test suite for xlwt into a pull request on github. Using the tests I made a port that is working on both 2.7 and 3.3. I haven't yet tested with earlier versions of Python. I think it ought to work back to 2.6 at least. Anyway, I figured a pull request might be premature so I thought I'd just share the repository. You can find the port at <https://github.com/hansrwl/xlwt/tree/py3>. There is one test that's currently failing on Python 3 but it's just a result of dict ordering and maybe the test should be fixed.

Thanks,
Hans

--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-excel...@googlegroups.com.
To post to this group, send an email to python...@googlegroups.com.
Visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hans Lawrenz

unread,
May 12, 2013, 9:26:16 PM5/12/13
to python...@googlegroups.com, ton...@googlemail.com
Hi Tony,

I'll give your changes a try. I saw your pull request when I submitted the tests and I had trouble with it but I see that's because I didn't realize it required 2to3. This was my first stab at porting something to work between 2 and 3. I'm not sure which approach is better. I'll defer to the maintainers. I'm happy to help however I can though.

Thanks,
Hans

Chris Withers

unread,
May 13, 2013, 8:10:31 AM5/13/13
to python...@googlegroups.com, Tony Roberts
Hi Guys,

Very keen to see this all happen, and very interested in reviewing pull
requests with the following caveats:

- no pre-compilation steps (2to3, etc), they cause major suck.

- no added external dependencies (six, etc), since we don't want to have
xlrd or xlwt have other mandatory dependencies other than the stdlib.

What is lib2to3?

Chris
> <mailto:python-excel%2Bunsu...@googlegroups.com>.
> To post to this group, send an email to
> python...@googlegroups.com <mailto:python...@googlegroups.com>.
> Visit this group at
> http://groups.google.com/group/python-excel?hl=en-GB.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "python-excel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python-excel...@googlegroups.com.
> To post to this group, send an email to python...@googlegroups.com.
> Visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Tony Roberts

unread,
May 13, 2013, 8:23:36 AM5/13/13
to python-excel, Chris Withers
Sorry - should have replied-all, forwarding to the rest of the group...

cheers,
Tony

---------- Forwarded message ----------
From: Tony Roberts <to...@pyxll.com>
Date: Mon, May 13, 2013 at 1:18 PM
Subject: Re: [pyxl] Python 3 port of xlwt
To: Chris Withers <ch...@simplistix.co.uk>


lib2to3 == 2to3

If you don't want to use that you might want to just run it once and keep the resulting python 3 code as a separate fork. I've used it for quite a few packages that were previously python 2 only and found it to be pretty helpful; guess you must have had other experiences if it's caused you 'major suck'.

cheers,
Tony


    <mailto:python-excel%2Bunsu...@googlegroups.com>.

    To post to this group, send an email to

    Visit this group at
    http://groups.google.com/group/python-excel?hl=en-GB.
    For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google
Groups "python-excel" group.
To unsubscribe from this group and stop receiving emails from it, send

To post to this group, send an email to python...@googlegroups.com.
Visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.



______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

Tony Roberts

unread,
May 13, 2013, 8:42:23 AM5/13/13
to Chris Withers, python-excel
Hi Chris,

fair enough, I agree trying to maintain two forks would be a nightmare. I didn't have any problems with speed, but it sounds like you've been there before and conceptually I do agree that having to pre-process code is far from ideal. I'll continue using my 2to3 version for now since it's working for me. If I get some spare time I'll take a look at replacing 2to3 with a compatibility module as per xlrd - but since that's likely to be far more invasive I'll probably leave that until some unit tests are ready, and it sounds like that won't be too far away.

cheers,
Tony



On Mon, May 13, 2013 at 1:25 PM, Chris Withers <ch...@simplistix.co.uk> wrote:
Hi Tony,

Yeah, reasons we binned the 2to3 approach for xlrd:

- maintaining two forks is untenable

- having 2to3 run as part of setup.py is ridiculously slow and causes other annoyances (I can't remember them offhand).

What we did for xlrd (and which is the way to go for xlwt) is to have a compat.py (it's called timemachine.py in xlrd for historical reasons) and then write code that works in py2.6-2.7,3.2+ which is not a hard target at all.

For those stuck on 2.5 or less (which is actually a surprisingly tiny number of people now) we offer to do bugfix releases if requested, but none have ever been requested...

Chris


On 13/05/2013 13:18, Tony Roberts wrote:
lib2to3 == 2to3

If you don't want to use that you might want to just run it once and
keep the resulting python 3 code as a separate fork. I've used it for
quite a few packages that were previously python 2 only and found it to
be pretty helpful; guess you must have had other experiences if it's
caused you 'major suck'.

cheers,
Tony


On Mon, May 13, 2013 at 1:10 PM, Chris Withers <ch...@simplistix.co.uk
<mailto:ch...@simplistix.co.uk>> wrote:

    Hi Guys,

    Very keen to see this all happen, and very interested in reviewing
    pull requests with the following caveats:

    - no pre-compilation steps (2to3, etc), they cause major suck.

    - no added external dependencies (six, etc), since we don't want to
    have xlrd or xlwt have other mandatory dependencies other than the
    stdlib.

    What is lib2to3?

    Chris


    On 12/05/2013 22:41, Tony Roberts wrote:

        Hi Hans,

        you might want to take a look at my pull request from the other
        day, or
        take a look at https://github.com/__tonyroberts/xlwt
        <https://github.com/tonyroberts/xlwt>. I've not tested as

        many features, but it's working well enough for what I need. I just
        thought I'd mention it as I chose to make as few changes as
        possible and
        use lib2to3 to do the rest (so you have to build it using
        setup.py in
        order for it to work). It doesn't use six so will work with python
        versions prior to 2.4 and has no other additional dependencies.

        I'm happy for you to pick and chose anything you want from it,
        or ignore
        as you see fit.

        cheers,
        Tony

        On Sun, May 12, 2013 at 5:06 PM, Hans Lawrenz
        <hrla...@gmail.com <mailto:hrla...@gmail.com>
        <mailto:hrla...@gmail.com <mailto:hrla...@gmail.com>>> wrote:

             Hi,

             A couple days ago I put in the beginnings of a test suite
        for xlwt
             into a pull request on github. Using the tests I made a
        port that is
             working on both 2.7 and 3.3. I haven't yet tested with earlier
             versions of Python. I think it ought to work back to 2.6 at
        least.
             Anyway, I figured a pull request might be premature so I
        thought I'd
             just share the repository. You can find the port at

        <https://github.com/hansrwl/xlwt/tree/py3>>. There is one test
        that's
             currently failing on Python 3 but it's just a result of dict
             ordering and maybe the test should be fixed.

             Thanks,
             Hans

             --
             You received this message because you are subscribed to the
        Google
             Groups "python-excel" group.
             To unsubscribe from this group and stop receiving emails
        from it,
             send an email to
        python-excel+unsubscribe@__googlegroups.com
        <mailto:python-excel%2Bunsu...@googlegroups.com>
        <mailto:python-excel%__2Bunsu...@googlegroups.com
        <mailto:python-excel%252Bunsubscribe@googlegroups.com>__>.


             To post to this group, send an email to
        python...@googlegroups.com
        <mailto:python-excel@googlegroups.com>
        <mailto:python-excel@__googlegroups.com

        <mailto:python-excel@googlegroups.com>>.

             Visit this group at
        http://groups.google.com/__group/python-excel?hl=en-GB
        <http://groups.google.com/group/python-excel?hl=en-GB>.
             For more options, visit
        https://groups.google.com/__groups/opt_out
        <https://groups.google.com/groups/opt_out>.




        --
        You received this message because you are subscribed to the Google
        Groups "python-excel" group.
        To unsubscribe from this group and stop receiving emails from
        it, send
        an email to python-excel+unsubscribe@__googlegroups.com

        <mailto:python-excel%2Bunsu...@googlegroups.com>.
        To post to this group, send an email to
        python...@googlegroups.com
        <mailto:python-excel@googlegroups.com>.
        Visit this group at
        http://groups.google.com/__group/python-excel?hl=en-GB
        <http://groups.google.com/group/python-excel?hl=en-GB>.
        For more options, visit
        https://groups.google.com/__groups/opt_out
        <https://groups.google.com/groups/opt_out>.



        __________________________________________________________________________

        This email has been scanned by the Symantec Email Security.cloud
        service.
        For more information please visit http://www.symanteccloud.com
        __________________________________________________________________________



    --
    Simplistix - Content Management, Batch Processing & Python Consulting
                 - http://www.simplistix.co.uk



______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

Hans Lawrenz

unread,
May 13, 2013, 9:43:53 AM5/13/13
to python...@googlegroups.com, Chris Withers
Chris,

I'll go ahead and get rid of the dependency on six. Only a few things were used from it anyway. I'm glad you said 2.6 - 3.2+, that makes things a lot simpler. 

Thanks,
Hans




To unsubscribe from this group and stop receiving emails from it, send an email to python-excel...@googlegroups.com.
To post to this group, send an email to python...@googlegroups.com.
Visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Werner

unread,
May 13, 2013, 1:08:42 PM5/13/13
to python...@googlegroups.com
On 13/05/2013 14:10, Chris Withers wrote:
> Hi Guys,
>
> Very keen to see this all happen, and very interested in reviewing
> pull requests with the following caveats:
>
> - no pre-compilation steps (2to3, etc), they cause major suck.
>
> - no added external dependencies (six, etc), since we don't want to
> have xlrd or xlwt have other mandatory dependencies other than the
> stdlib.
Maybe an alternative is to just distribute six.py (only 400 lines and I
would guess quit stable by now) with xlwt - that is the option wxPython
is taken for the Phoenix project.

Werner

Chris Withers

unread,
May 15, 2013, 10:59:39 AM5/15/13
to python...@googlegroups.com, Werner
On 13/05/2013 18:08, Werner wrote:
> Maybe an alternative is to just distribute six.py (only 400 lines and I
> would guess quit stable by now) with xlwt - that is the option wxPython
> is taken for the Phoenix project.

What license is six.py distributed under?

Chris

Hans Lawrenz

unread,
May 15, 2013, 11:11:51 AM5/15/13
to python...@googlegroups.com, Werner
MIT. In what I am working on I've already taken out the majority of the six dependencies. For the remainder I could use it or rewrite the maybe six routines that I'm using.


--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-excel+unsubscribe@googlegroups.com.

Chris Withers

unread,
May 15, 2013, 11:17:06 AM5/15/13
to python...@googlegroups.com, Hans Lawrenz, Werner
Cool, I'm neutral on six.py:

- I don't think we'll need most of it, the xlrd compat stuff ended up
being very small

- If it was used in a pull request, I would NOT reject the pull request
based on that ;-)

Chris

On 15/05/2013 16:11, Hans Lawrenz wrote:
> MIT. In what I am working on I've already taken out the majority of the
> six dependencies. For the remainder I could use it or rewrite the maybe
> six routines that I'm using.
>
>
> On Wed, May 15, 2013 at 10:59 AM, Chris Withers <ch...@simplistix.co.uk
> <mailto:ch...@simplistix.co.uk>> wrote:
>
> On 13/05/2013 18:08, Werner wrote:
>
> Maybe an alternative is to just distribute six.py (only 400
> lines and I
> would guess quit stable by now) with xlwt - that is the option
> wxPython
> is taken for the Phoenix project.
>
>
> What license is six.py distributed under?
>
> Chris
>
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
> - http://www.simplistix.co.uk
>
> --
> You received this message because you are subscribed to the Google
> Groups "python-excel" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to python-excel+unsubscribe@__googlegroups.com
> <mailto:python-excel%2Bunsu...@googlegroups.com>.
> To post to this group, send an email to
> python...@googlegroups.com <mailto:python...@googlegroups.com>.
> Visit this group at
> http://groups.google.com/__group/python-excel?hl=en-GB
> <http://groups.google.com/group/python-excel?hl=en-GB>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "python-excel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to python-excel...@googlegroups.com.
> To post to this group, send an email to python...@googlegroups.com.
> Visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________

Thomas Kluyver

unread,
May 16, 2013, 11:14:19 AM5/16/13
to python...@googlegroups.com, Hans Lawrenz, Werner
On Wednesday, 15 May 2013 16:17:06 UTC+1, Chris Withers wrote:
Cool, I'm neutral on six.py:

- I don't think we'll need most of it, the xlrd compat stuff ended up
being very small

- If it was used in a pull request, I would NOT reject the pull request
based on that ;-)

If I was starting another port, I'd probably just include six.py - lots of projects already do so, and it will be better tested than writing new compatibility functions. It's not very big, but you can always strip out functionality you're not using if you prefer.

Thomas
Reply all
Reply to author
Forward
0 new messages