AtChem / AtChem2

Atmospheric chemistry box-model for the MCM
MIT License
59 stars 22 forks source link

Drop Python2 support #415

Open rs028 opened 4 years ago

rs028 commented 4 years ago

Probably need to switch completely to Python3 at some point , instead of relying on __future__.

Python2 is being phased out in 2020 (https://www.python.org/doc/sunset-python-2/).

It also does not make sense to have two plotting scripts for python 2 and 3, when the actual difference between them is not the python version but that one uses numpy and the other uses pandas.

spco commented 4 years ago

As I understand it, the scripts using __future__ are compatible with both 2 and 3. We could remove the __future__ import line, and that would break the compatibility with 2, but that's really all.

spco commented 4 years ago

As for the plotting tools - yes, the _v2 is only python2 because of the print statement but that's it - we could add a __future__ import and change the print function and that would be both 2- and 3-compatible. the _v3 script is 3-only, but could have the same import to make it 2-compatible as well.

As you say, the naming is a bit odd if the real difference is pandas vs numpy. Do we want to keep both in, or slim it down to one and demand either numpy or pandas?

rs028 commented 4 years ago

Yes, I suppose it won't matter to lose the support of python2 if it is going to be discontinued eventually. For the moment I think it is fine to keep it.

Re the plotting tools yes I agree, maybe I will just rename them and add import __future__, for the moment.

spco commented 4 years ago

For the moment I think it is fine to keep it.

Absolutely - there are far too many systems out there that still don't use python3, so for the sake of an extra few lines in our source code, keeping compatibility is worth doing.

rs028 commented 4 years ago

Python scripts are version independent now. Eventually will drop support for Python2.

spco commented 3 years ago

Is this done, and can be closed? (or renamed to 'drop Python2 support')

rs028 commented 3 years ago

I think now the python scripts are version independent. Not sure if they are all version 3. I meant to run 2to3 (https://docs.python.org/3/library/2to3.html) but I haven't had the chance yet. I will rename it as you suggest.