Skip to content

Warn for pending deprecation of Python 2.7 #908

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

Merged
merged 6 commits into from
Nov 7, 2018

Conversation

Conengmo
Copy link
Member

@Conengmo Conengmo commented Jul 13, 2018

I propose we drop support for Python 2.7 at the end of this year. That's one year before official support stops, but other packages are also dropping support before that time. Numpy for example, one of our dependencies, stops development for 2.7 at the end of this year. Check out https://python3statement.org/

I don't know how many of our users are still on 2.7. I suppose not that many, since I don't think folium is a library that's used in heavy production code that would be hard to migrate to Python 3. But still, it's good manners to give some time to warn before dropping support I suppose. I set the actual date on 1-1-2019, but that's debatable.

There is probably not a lot that will change in the code base when we drop support. Still, I would like to not have to think about and test for 2.7 anymore.

@ocefpaf do you want to comment on this proposal?

@Conengmo Conengmo requested a review from ocefpaf July 13, 2018 09:01
Conengmo added 2 commits July 13, 2018 12:41
importlib does exist in 2.7, it just doesn't have the reload function.
@@ -10,6 +10,8 @@

import json
import os
import warnings

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F401 'warnings' imported but unused

@Conengmo Conengmo mentioned this pull request Jul 21, 2018
@ocefpaf ocefpaf merged commit a61365c into python-visualization:master Nov 7, 2018
@Conengmo Conengmo deleted the python-2-deprecation branch November 7, 2018 13:35
@Conengmo
Copy link
Member Author

Conengmo commented Jan 2, 2019

I came across a tool to check Pypi statistics, so I used it to check out what version our users are using.

pypistats python_minor --last-month folium

| category | percent | downloads |
|----------|--------:|----------:|
|      2.7 |  54.35% |    51,822 |
|      3.5 |  20.42% |    19,469 |
|      3.6 |  15.81% |    15,072 |
|      3.7 |   4.13% |     3,934 |
|      3.4 |   3.29% |     3,138 |
| null     |   2.01% |     1,912 |
|      2.6 |   0.00% |         2 |
| Total    |         |    95,349 |

So I guess half our use base will be in trouble if we drop support for Python 2.7? Of course they don't have to update, then they are fine. Maybe we can make a 2.7 branch where we do accept bug fixes.

This is a good resource on how to deal with the transition:
https://github.com/python3statement/python3statement.github.io/blob/master/_practicalities/intro.md

@jtbaker
Copy link
Contributor

jtbaker commented Jan 2, 2019

Wow, I had no idea the numbers were so high! Cool to know it's getting used by so many people.

Guessing the Python 2.7 majority is coming from the fact that that's the base installation that comes shipped on most people's machines(I know that's the case for Macs at least).

I don't have a lot of experience backporting to support legacy code/languages, but are some of the breaking changes something that could be averted by adding __future__ as a dependency, and a check on sys.version_info.major at run time?

Something like this in folium's __init__.py:

py_major_version = sys.version_info.major

if py_major_version is 2:
    from builtins import *

edit:

Guess I could have checked.

Are there cases where these imports are not providing full coverage for the language's features - or changes waiting to be implemented that will be breaking changes to the API?

Are there Python 2.7 - specific bugs getting filed on the issue tracker right know? Or is this just kind of a well-mannered phase-out?

@Conengmo
Copy link
Member Author

Conengmo commented Jan 3, 2019

Cool to know it's getting used by so many people.

Right! I don't know how trustworthy those numbers are but I'm liking them :)

Are there cases where these imports are not providing full coverage for the language's features - or changes waiting to be implemented that will be breaking changes to the API?

No, folium is fully compatible with 2.7 right now, and no breaking changes are waiting.

Are there Python 2.7 - specific bugs getting filed on the issue tracker right know?

Not that I know of.

Or is this just kind of a well-mannered phase-out?

Yes, that's it. If think maintaining will be easier and more fun if we can use Python 3.5 and higher features. I wasn't expecting so many users to still be on 2.7 though. If we drop support now half our use base cannot upgrade.

I'm now thinking we maybe should extend support for half a year, but increase the warning level to a user warning, as is also recommended here:
https://github.com/python3statement/python3statement.github.io/blob/master/_practicalities/intro.md#runtime-warning-on-master

What do you think?

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

Successfully merging this pull request may close these issues.

4 participants