Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility #46

Closed
QuLogic opened this issue Jul 10, 2015 · 16 comments
Closed

Python 3 compatibility #46

QuLogic opened this issue Jul 10, 2015 · 16 comments
Milestone

Comments

@QuLogic
Copy link
Contributor

QuLogic commented Jul 10, 2015

For such a new project, there should be no reason why it can't support both 2 and 3.

@mdraw
Copy link

mdraw commented Jul 13, 2015

I think the reason (or at least one of them) is the dependency Pydap, which is not Python 3 compatible yet and doesn't seem to be updated any more: pydap/pydap#7

@QuLogic
Copy link
Contributor Author

QuLogic commented Jul 14, 2015

That's unfortunate, but no reason not to make this one prepared for it.

And actually, I was really just gauging interest; it's not that difficult for me to open some PRs for it.

@davidtrem
Copy link

Yes, python 3 support please 👍

@jreadey
Copy link
Member

jreadey commented Jul 16, 2015

If the file plugins get imported dynamically (currently they are static imports), I guess it would be feasible to just ignore plugins that aren't python 3 compliant. That would likely make the pyinstaller more tricky though.

@QuLogic
Copy link
Contributor Author

QuLogic commented Jul 16, 2015

That is not difficult to accomplish. If dependencies are not available, simply don't register the plugin.

@QuLogic
Copy link
Contributor Author

QuLogic commented Jul 21, 2015

It looks like the biggest hindrance is going to be wxPython, which is lagging behind pretty much every toolkit WRT Python 3 bindings.

@giumas
Copy link
Collaborator

giumas commented Sep 14, 2015

Is there a reason that stops by adding: from __future__ import absolute_import, division, print_function, unicode_literals at the top of each module and modify the code as required? If not, is there a branch where a similar work is in progress?

@QuLogic
Copy link
Contributor Author

QuLogic commented Sep 14, 2015

To make for smaller and easier-to-review PRs. But there is no other work because upstream here does not seem to be showing any interest.

@giumas
Copy link
Collaborator

giumas commented Sep 14, 2015

@QuLogic: Have you been able to run HDFCompass on Python 3? Using the last wxPython night-built wheels, I have found that there is a open ticket with Matplotlib and the Phoenix backend: matplotlib/matplotlib#3421
I am currently on Windows using mpl 1.4.3, but the patch should be still in dev: http://stackoverflow.com/questions/31467759/missing-wxversion-when-using-matplotlib-with-wxpython-phoenix-in-python3

@QuLogic
Copy link
Contributor Author

QuLogic commented Sep 14, 2015

No, sorry; I have not done much more. I would be happy to continue if upstream showed some interest, but I'm not going to waste time on fruitless endeavours.

@jreadey
Copy link
Member

jreadey commented Sep 14, 2015

I'd be interested in hearing from anyone who got HDFCompass running on Python 3. Right now I'm a little hesitant to invest time to it since there seems there's a high probability of hitting issues with other packages.

Failing some positive evidence to support Python 3 (like the wxPython issue being closed), I'd like to focus on functionality in the app for now and do Python 3 at a latter date.

Once Python 3 is enabled the question becomes do we continue to support backward compatibility with Python 2 or just become a Python 3 only package. As an application (rather than a library that other Python 2 packages may depend on), I assume most people would be fine with Python 3 only.

@giumas
Copy link
Collaborator

giumas commented Sep 15, 2015

@jreadey , I totally agree with your point. My intent was to just evaluate the amount of work involved to reach the Python 3 portability before splitting it in small PRs. Since the application is relatively small, I believe that there is not so much of work (several print statements, the substitution of cStringIO with BytesIO, ...).

However, given the current Matplotlib (1.4.3) issue with the wxAgg backend, I would suggest to wait the next release (1.5.0) to reconsider the situation. (I don't really want to re-open here the never-ending battle between wx and Qt, but I would be curious to know the reason of the wx selection for this project.)

Given that there are many libraries that are still Py2-only as well as that the price to maintain Python 2-3 portability is quite low, I would suggest to maintain once obtained for a while.

@QuLogic: what are your thoughts on this?

@QuLogic
Copy link
Contributor Author

QuLogic commented Sep 28, 2015

A naive translation is:

$ git di --shortstat 
 11 files changed, 30 insertions(+), 17 deletions(-)

It is positively tiny. Of course, if going for 2/3 compatibility, there should be a few other changes, but not too many. Based on matplotlib's PR, you will have more problems porting to wxPython-Phoenix.

This was referenced Oct 2, 2015
@jreadey jreadey mentioned this issue Oct 9, 2015
20 tasks
@giumas giumas added this to the 0.6.0 milestone Oct 20, 2015
@giumas
Copy link
Collaborator

giumas commented Oct 27, 2015

Using matplotlib 1.5.0rc3 and wxPython 3.0.3.dev, I have been able to run the app for the first time:

capture

However, there are several issues related to the migration from 'classic' wxPython to Phoenix (some of them listed here: http://wxpython.org/Phoenix/docs/html/MigrationGuide.html) that would require a certain number of conditional statements (given that the back compatibility has been broken in multiple ways).

Apart from polluting the code with these statements, at today there is still not a 'stable' cross-platform Phoenix release for Python 3.

Thus, I am closing this ticket as 0.6.0 milestone, and I would propose to open a new one for Phoenix adoption once that a stable py3 version will be released.

@giumas giumas closed this as completed Oct 27, 2015
@jreadey
Copy link
Member

jreadey commented Oct 27, 2015

@giumas - thanks for checking this out. We'll re-evaluate switching to Python3 for a future releases.

@giumas
Copy link
Collaborator

giumas commented Oct 28, 2015

After wxPython/matplotlib, pydap is the other blocking dependency to move to py3. Hopefully, this issue should be solved in the short term: pydap/pydap#14 and the already cited: pydap/pydap#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants