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

Drop Python 2 support #2012

Merged
merged 12 commits into from Jan 30, 2019
Merged

Drop Python 2 support #2012

merged 12 commits into from Jan 30, 2019

Conversation

cdeil
Copy link
Contributor

@cdeil cdeil commented Jan 30, 2019

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 of multiprocessing.Pool) will follow tomorrow in separate small PRs.


Following the advice here, I've added python_requires>=3.5 in setup.py, which declares to pip to never install Gammapy>=0.11 on Python 2.

$ pip2 install .
Processing /Users/deil/work/code/gammapy
gammapy requires Python '>=3.5' but the running Python is 2.7.15

I think that's enough, raising errors in setup.py or gammapy/__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:

  • Remove Python 2 CI builds
  • Update install docs
  • Remove gammapy/extern/six.py and adjust all users (manually)
  • Remove gammapy/extern/pathlib.py and adjust imports where it's used (manually)
  • Remove object as base class (possible using 2to3 or need to do manually?)
  • Remove __future__ imports (using 2to3)

@cdeil cdeil added the cleanup label Jan 30, 2019
@cdeil cdeil added this to the 0.11 milestone Jan 30, 2019
@cdeil cdeil self-assigned this Jan 30, 2019
@cdeil
Copy link
Contributor Author

cdeil commented Jan 30, 2019

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.

@cdeil cdeil mentioned this pull request Jan 30, 2019
Copy link
Member

@adonath adonath left a 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:-)

Copy link
Member

@adonath adonath left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants