gadsbyfly / PyBioMed

machine learning, molecular descriptor
http://pybiomed.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
109 stars 61 forks source link

Python 3 support #3

Open MartinThoma opened 4 years ago

MartinThoma commented 4 years ago

This project seems to be Python 2 only. Python 2 got deprecated with the end of 2019. Do you plan to move to Python 3? Do you need support with that?

hsiaoyi0504 commented 4 years ago

Upvote for this issue. I also think using some sort of semi-automatic way to convert the code base will be better. For example, use 2 to 3.

MartinThoma commented 4 years ago

I also think using some sort of semi-automatic way to convert the code base will be better

Better than what? I used 2to3 for the two PRs :laughing: - I just do it step-by-step so that it is easier to check. 2to3 has some flaws.

hsiaoyi0504 commented 4 years ago

@MartinThoma Oops, I didn’t know that you use 2 to 3 already. What kinds of flaws do you mean?

MartinThoma commented 4 years ago

There is only one I've stumbled over: If you already use print as a function in Python 2, e.g. print(1), then 2to3 will convert it to print((1)). Of course, this is not wrong. But it is not nice either. Also, from urllib2 import urlopen is always replaced by 3 different imports. Most of the time, the other 2 imports are not necessary.

So I like applying 2to3 step by step. print was done, imports were done. I plan the following next steps:

  1. Code formatting: If I contribute more, I want to feel comfortable with the style of the codebase https://github.com/gadsbyfly/PyBioMed/pull/6
  2. pytest / tox: I want to make sure that everything works as expected, so I will make pytest work. There seem to be unittests, but I only get 4x "No module named" (part of the reason is that I didn't install rdkit so far)
  3. Travis CI Pipeline

I guess while improving the testing capabilities I will also make sure that it works for Python 3. Lets see :-)