UKZN-Astronomy / corrcal

Python/C code for calibration of quasi-redundant arrays. Different (fixed) algorithm from original corrcal
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Migrate codes to Python 3 #12

Closed piyanatk closed 4 years ago

piyanatk commented 4 years ago

The Python codes need to be migrate to Python 3 since Python 2 will be depreciated at the end of 2019. Since we fork from @ronniyjoseph , most of the works have been done. Is there anything else that need to be changed?

piyanatk commented 4 years ago

@ronniyjoseph Could you maybe check if the current codes in restructure branch pass items 3, 4, and 5 in this list just for completeness before closing this issue? https://docs.python.org/3/howto/pyporting.html#the-short-explanation

ronniyjoseph commented 4 years ago

So you'd like the code to be Python 2.7 and 3+ compatible?

I ran Jon's example code in python 2 and 3 and that works. My own mini-sims with corrcal are written in python 3, so I couldn't run that.

So there are still many improvements to make, but should be python 3 and 2 compatible

piyanatk commented 4 years ago

@ronniyjoseph I think we should completely drop Python 2 and only support Python 3. Python 2 will be retired at the end of this year, so we should not support it.

Did Pylint give you any diagnostic?

piyanatk commented 4 years ago

I ran the 2to3 script that is included in the standard library on the Python codes in https://github.com/UKZN-Astronomy/corrcal/commit/68d44cda124d738ac363f35a0a0862355302ff64. Several extra parentheses were removed from the print statement. Everything else looks fine.

Pylint gave the code a whopping 2.45 out of 10

I will double check Pylint results

piyanatk commented 4 years ago

Okay. It looks like pylint mostly check for PEP8. In this regard, I think Python 3 migration is finished. We will need to tidy up the code, but there is a separate issue.