Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Py3.3 support for xlwt #32

Closed
wants to merge 22 commits into from
Closed

Conversation

edschofield
Copy link

Hi John,

I have patched xlwt to support Python 3.3 as well as Python 2.6/2.7 with a single codebase (i.e. no embedded 2to3 conversion).

This currently introduces one dependency: my future package for Py2/3 compatibility.

I would be interested in your feedback. The patch set is big but most of the changes should be uncontroversial (e.g. converting print statements to print functions). The unicode / bytes disambiguation was the most difficult part.

It seems to work now under both Python 3.3 and Python 2.7 for all the example scripts, but this could do with more testing.

Kind regards,
Ed Schofield (ed@pythoncharmers.com)

* Currently uses the future module for py2k compatibility. Only a couple of
  functions (just ``range`` and ``str``, I think) are used, so this dependency
  could be removed easily enough.
* Why is the diff so noisy??
* Also add future==0.4.0 to requirements.txt. This is not currently read; it is
  for the user's info only ...
* Mention Py3 compatibility and dependency on ``future``
* The diff was way too big. Why??
* Ah ... this file has CRLF line terminators ;)
@goinnn
Copy link

goinnn commented Oct 7, 2013

I am very interested in this pull request

@HubertHolin
Copy link

I am very interested in this pull request as well. I do need to output Excel files at work, and I would definitely like to move my full toolchain to Python3. This (and xlutils, as I also frequently have to copy incoming files before enriching them), is the last important holdout.

@edschofield
Copy link
Author

For those watching this, I have uploaded this as a fork to PyPI as xlwt-future until the maintainer responds. You can install it on either Python 2.6/2.7 or Python 3.3 with::

pip install xlwt-future

Please post any bugs or problems as comments here for now.

@ghost
Copy link

ghost commented Dec 28, 2013

Hi, i just found this, great stuff...but must wonder a bit where the maintainers have gone..

My only objection is using the u"" explicit unicode syntax that only 3.3 started allowing again before 3.3 is out on platforms like Ubuntu LTS and others(they use 3.2). However, that is not likely a valid one, as the next Ubuntu LTS that is out in april has as a release goal to be python 3 only, and then it would be very strange to stay with 3.2.

So Is there some important reason for using explicit u"", or can I just change that to implicit and go on for now?

Again, good work!

@MattDMo
Copy link

MattDMo commented Jan 14, 2014

@zig007 I would imagine they kept the u'string' syntax to maintain compatibility with Python 2, which requires it. Users of earlier Py3 releases (3.0-3.2) should be upgrading to the latest releases at some point, and it makes sense to use their features when they're widely available - Python 3.3 was released in Sept. 2012.

@ghost
Copy link

ghost commented Jan 14, 2014

Yeah, I suppose so.
Also, Ubuntu 14.04 LTS will use 3.3, so it is not that a big issue anymore.

I was rather asking if I would cause myself problems if I would change it to 3.2-syntax temporarily, if he knew something of the top of his head, to make it work with my project, as not all its other dependencies were compatible with 3.2 yet.

However, I have decided to upgrade everything to 3.3 now instead, so it doesn't matter.

Thanks everyone!!

This was referenced Jan 25, 2014
@SalvaJ
Copy link

SalvaJ commented Mar 19, 2014

I would like to test xlwt-future in 3.3.5.
Where can I report you the bugs or my feedback?

@cjw296
Copy link
Member

cjw296 commented Mar 19, 2014

@SalvaJ : xlwt-future is a fork, please contact its maintainers.

@SalvaJ
Copy link

SalvaJ commented Mar 19, 2014

@cjw296 Where is that fork?

@cjw296
Copy link
Member

cjw296 commented Apr 7, 2014

@edschofield , @takluyver - where are we on this?

At the very least, we need to drop the requirement for @edschofield 's "future" package, it should be replaced with a minimal compat.py is in xlrd here: https://github.com/python-excel/xlrd/blob/master/xlrd/timemachine.py

I'd also like to see Manfred's unit tests merged across...

If anyone has time for both of the above, I'll do my very best to get the reviewing and merging done as soon as I can and then get a release out...

@takluyver
Copy link
Contributor

I'll work on integrating Manfred's unit tests.

@takluyver
Copy link
Contributor

PR #42 adds the tests.

@takluyver
Copy link
Contributor

The tests are now merged, so it's ready for someone to merge @edschofield 's Python 3 changes in.

@jreback
Copy link

jreback commented Apr 24, 2014

is this a 'released' version of 3.3 compat for xlwt? https://pypi.python.org/pypi/xlwt-future

@cjw296
Copy link
Member

cjw296 commented Apr 24, 2014

@jreback - no, that's a fork.

@edschofield
Copy link
Author

@jreback: yes, it's a temporary fork until xlwt gains Py3 support.

@edschofield
Copy link
Author

@cjw296: thanks for your earlier message. I will see what I can do with removing the future imports. Is your desire just to remove all dependencies in general?

The downside to replacing the future imports with a minimal compat.py file is that the level of Py2/3 compatibility it provides would then be ... minimal. This would mean more Py2/3 compatibility hacks in the code itself and less test coverage of those hacks than future provides.

@jreback
Copy link

jreback commented Apr 24, 2014

@edschofield @cjw296 thanks for the info!

@takluyver takluyver mentioned this pull request Apr 26, 2014
@takluyver
Copy link
Contributor

I've done Python 3 support without external dependencies in #46.

@cjw296
Copy link
Member

cjw296 commented Apr 27, 2014

Okay, closing this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
8 participants