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

Convert the code to Python 3 #11

Closed
shlomif opened this issue Mar 16, 2016 · 29 comments
Closed

Convert the code to Python 3 #11

shlomif opened this issue Mar 16, 2016 · 29 comments

Comments

@shlomif
Copy link
Owner

shlomif commented Mar 16, 2016

As Python 2.x is going away, we need to convert the code to use Python 3 instead. A prerequisite for that is to merge duplicate or mostly duplicate code that uses the APIs that were removed in Python 3.

@AndersonTorres
Copy link

AndersonTorres commented Feb 25, 2017

Hum... Hello, @shlomif ! I want to contribute to that project!

I played pysolfc since the times I used Arch Linux. Now I use NixOS distribution[1], and contribute to it by creating install scripts for some pieces of software [2].
I tried to run the SF.net tarball, but it runs on some problems - basically, it doesn't recognize some paths when it is installed in a non-standard location.
While searching for solutions to it, I found your clone repo.

How can I help?

1 - NixOS Official Site: http://www.nixos.org;
2 - Github repo: https://github.com/NixOS/ ; packages repo: https://github.com/NixOS/

@shlomif
Copy link
Owner Author

shlomif commented Feb 25, 2017

Hi @AndersonTorres ! Thanks for your enthusiasm and desire to contribute. I appreciate it a lot. Currently, the main pending item is to convert the code to Python 3, but it has some prerequisites. If you can GitHub-fork the repository, create a branch and send me a pull-request that will involve one of those:

1 . Merging some duplicate code (see the recent commits into https://github.com/shlomif/PySolFC/tree/master/pysollib/ui/tktile but others may be needed).

  1. Converting code from using old APIs that were removed in python 3 to newer APIs.

  2. Copy+pasting the old APIs from the python 2.x source into a private module of ours assuming they are pure python.

  3. Other cleanups.

I will review your changes, test them and given enough merged pull reqs , I can give you a commit bit. Welcome aboard and thanks again!

@shlomif
Copy link
Owner Author

shlomif commented Feb 28, 2017

@AndersonTorres : hi! Ping! Did you get my latest message? Can you please let me know what you think?

@GoodPie
Copy link

GoodPie commented Apr 7, 2017

Hey. I'm interested in helping convert to Python 3. If you still need help, let me know what you would like me to work on.

@josecolella
Copy link

@shlomif I am also interested in helping the conversion to Python 3. Let me know what you would like me to work on

@niharathomas
Copy link

Also interested in helping out here! 🙋

@shlomif
Copy link
Owner Author

shlomif commented Apr 7, 2017

Thanks for your enthusiasm, people! Let's do it like that - the three of you will run the "2to3" tool locally on the tree and each will handle a range of letters of files under pysollib to check for breakages. Let's start with:

@lostmyaccount : [a-c]*.py

@josecolella : [d-f]*.py

@niharathomas : [g-i]*.py

Thanks!

@eckorog2005
Copy link

let me know if you need more help.

@whitenj
Copy link

whitenj commented Apr 8, 2017

How can I help?

@AndersonTorres
Copy link

Sorry, real life issues! I will clone it asap.

@shlomif
Copy link
Owner Author

shlomif commented Apr 8, 2017

@AndersonTorres : ok, thanks for returning to me. Good luck!

@shlomif
Copy link
Owner Author

shlomif commented Apr 8, 2017

Hi all! To facilitate coordination about contributing to PySol, please join me for a real time Internet chat on ##pysol on Freenode (note the double octhothrope) . I am usually "rindolf" there with a fallback "shlomif" nickname. We may set up chat rooms on different services in the future.

This was referenced Apr 16, 2017
@AndersonTorres
Copy link

AndersonTorres commented Apr 18, 2017

Well, as far as I have seen, the diff produced by 2to3 has 14996 lines!
In need to confess it is a little adventure to me, hehe!

What is the best way to do it? Testing unit by unit?

@hairspring
Copy link

Should this feature request "we need to convert the code to use Python 3 instead", be "... Python 3 AS WELL"? Many systems still ship with Python 2 (e.g. 2.7) by default.

@AndersonTorres
Copy link

I don't think it would be a good idea to use a "dual version" - it would be duplicating the work.

@hairspring
Copy link

Hi Anderson, I wasn't imagining duplicating work, I agree that would be a bad idea.

https://docs.python.org/3/howto/pyporting.html

First paragraph: With Python 3 being the future of Python while Python 2 is still in active use, it is good to have your project available for both major releases of Python. This guide is meant to help you figure out how best to support both Python 2 & 3 simultaneously.
(my bold)

@shlomif
Copy link
Owner Author

shlomif commented Apr 18, 2017

@hairspring , @AndersonTorres : hi! It is often possible to write code that will run on both python 2.x and py 3.x. However, it may not always be worth the trouble. I should not that a recent python 3 environment can be easily installed alongside the system's python 2 environment (and it's open source and gratis), so it should not be a major concern. So I suggest we try to keep python 2 compat, but not at all costs.

@jan-kleks
Copy link

jan-kleks commented Apr 18, 2017

Does dropping Python 2 support can cause any issues for the users? I guess the Windows and macOS versions will be just shipped with Python 3, and when it comes to Linux, I have found Python 3 even in the Debian repo (and Debian is known to be quite a conservative distro).

@whitenj
Copy link

whitenj commented Apr 18, 2017 via email

@shlomif
Copy link
Owner Author

shlomif commented Apr 18, 2017 via email

@hairspring
Copy link

@shlomif Of course Python 2 support at all costs would be a mistake, but I don't get the impression it's a nightmare.

@jan-kleks Yes, Python 3 is in repositories. But you're saying that while wearing your programmer's hat!

Remember, most of those interested in running PySol want to press a download button, click install, and if it gets harder than that, game over! Admittedly, right now this github fork (?) is not for them, there's no install media as there is on SourceForge. But eventually, that's the scenario we have to keep in mind if the work here is to be reintegrated with skomoroh's project or to gain widespread support as an alternative.

So it will be easier to achieve that if the code runs on 2.7 and 3 upwards. I discount versions prior to 2.7 because I'm unaware of any mainstream platforms that aren't at least at that level.

@AndersonTorres
Copy link

In fact the link you provided says it is better to maintain only Py27 from 2x series if there is some need to dual porting.
But this isn't a serious problem I think. The major Linux distros already have Py3 in repos, and Py2 is to be deprecated someday.

The veredict was spoken, however.

@whitenj
Copy link

whitenj commented Apr 19, 2017 via email

@shlomif
Copy link
Owner Author

shlomif commented Apr 19, 2017 via email

shlomif added a commit that referenced this issue Apr 19, 2017
@shlomif
Copy link
Owner Author

shlomif commented Apr 19, 2017

@whitenj : hi! I've updated the build instructions in the README file - there was a bug there. Please try again.

@shlomif
Copy link
Owner Author

shlomif commented Jun 3, 2017

Hi all!

I've been making headway with the conversion (after using flake8 and 2to3) here - https://github.com/shlomif/PySolFC/tree/try-to-fix-py3-bugs . It now kinda works in both python 2 and python 3, but some functionality was temporarily removed, and some may still be broken. It also needs some cleanups.

@shlomif
Copy link
Owner Author

shlomif commented Jun 11, 2017

Hi all!

If you wish to contribute, you can tackle some of the issues with the label "bug", or do extensive testing on the py3 branch to see if there are more bugs.

@lostmyaccount :

@josecolella :

@niharathomas :

@AndersonTorres :

@craigmac
Copy link

Still looking for any help? I have experience with building python2/3 compatible GUIs in tkinter/Tkinter (depending on 2/3 heh) and recently with Kivy to build cross-platform touch-enabled app. I'm looking for something to help out on in any way I can. Hopefully talk soon!

@shlomif
Copy link
Owner Author

shlomif commented Aug 17, 2017

@saltycraig : the transition to python2/3 compatible code is mostly complete in the relevant branch. Nevertheless, more testing will be appreciated and one can also work on some of the feature requests or bug reports. I am going to close this bug to avoid misleading people.

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

10 participants