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 12 commits into from Jan 30, 2019


None yet
2 participants
Copy link

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, 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 or gammapy/ 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/ and adjust all users (manually)
  • Remove gammapy/extern/ 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


This comment has been minimized.

Copy link
Member 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 referenced this pull request Jan 30, 2019


Remove Python 2 support #1963

Copy link

adonath left a comment

Thanks @cdeil! Yes, please go ahead and just merge...we've been waiting for this day already:-)

Copy link

adonath left a comment

Looks good to me!

@cdeil cdeil merged commit 6c1c8f4 into gammapy:master Jan 30, 2019

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Scrutinizer Analysis: No new issues – Tests: passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.