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
Drop Python 2 support #2012
Drop Python 2 support #2012
Conversation
This is not needed in Python 3, new-style classes are the default.
This PR is ready. @adonath or anyone interested - I don't think there's anything that needs review or is controversial here, but if you want, have a look (review one commit at a time should be easy). I'll wait a few hours before merging. I would suggest to keep #1963 for about another week and discuss / gather suggestions for non-trivial updates (like using ProcessPoolExecutor or keyword-only arguments) there. If anyone finds something that can be modernised or cleaned up in Gammapy now that we're Python 3.5+, or if there is a feature we could start using, please leave a comment there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cdeil! Yes, please go ahead and just merge...we've been waiting for this day already:-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This PR drops Python 2 support (see PIG 3 and #1963).
Here I only do the simple / obvious / partly automated changes. This will result in a large diff.
More specific changes that might require discussion (like e.g. using
concurrent.futures.ProcessPoolExecutor
instead ofmultiprocessing.Pool
) will follow tomorrow in separate small PRs.Following the advice here, I've added
python_requires>=3.5
insetup.py
, which declares to pip to never install Gammapy>=0.11 on Python 2.I think that's enough, raising errors in
setup.py
orgammapy/__init__.py
as mentioned here is only needed for users that have a pip that is 3+ years old, and try to update to new Gammapy, i.e. a tiny (possibly non-existent) fraction of our users.Other changes in this PR:
gammapy/extern/six.py
and adjust all users (manually)gammapy/extern/pathlib.py
and adjust imports where it's used (manually)object
as base class (possible using2to3
or need to do manually?)__future__
imports (using2to3
)