Skip to content

Prevent installing 0.9 on dropped Python versions #1100

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 2 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ env:
matrix:
fast_finish: true
include:
- name: legacy-python
env: PY=2.7
- name: default
env: PY=3.7
- name: notebooks-conding-standard
Expand Down Expand Up @@ -66,11 +64,6 @@ script:
pytest /tmp -vv --ignore=tests/notebooks/test_notebooks.py ;
fi

- if [[ $TRAVIS_JOB_NAME == 'legacy-python' ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

Glad to see this go away!

conda install mock ;
pytest /tmp -vv --ignore=tests/notebooks/test_notebooks.py ;
fi

- if [[ $TRAVIS_JOB_NAME == 'latest-branca' ]]; then
conda uninstall branca ;
pip install git+https://github.com/python-visualization/branca.git ;
Expand Down
30 changes: 21 additions & 9 deletions folium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@
from folium.raster_layers import TileLayer, WmsTileLayer
from folium.vector_layers import Circle, CircleMarker, PolyLine, Polygon, Rectangle

__version__ = get_versions()['version']
del get_versions

if tuple(int(x) for x in branca.__version__.split('.')[:2]) < (0, 3):
raise ImportError('branca version 0.3.0 or higher is required. '
'Update branca with e.g. `pip install branca --upgrade`.')

if sys.version_info < (3, 0):
warnings.warn(
('This version of folium is the last to support Python 2.'
' Transition to Python 3 to be able to receive updates and fixes.'
' Check out https://python3statement.org/ for more info.'),
UserWarning
)

__version__ = get_versions()['version']
del get_versions
raise ImportError(
"""You are running folium {} on Python 2

folium 0.9 and above are no longer compatible with Python 2, but somehow
you got this version anyway. Make sure you have pip >= 9.0 to avoid this
kind of issue, as well as setuptools >= 24.2:

$ pip install pip setuptools --upgrade

Your choices:

- Upgrade to Python 3.

- Install an older version of folium:

$ pip install 'folium<9.0'

""".format(__version__)) # noqa

__all__ = [
'Choropleth',
Expand Down
20 changes: 18 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@
from __future__ import (absolute_import, division, print_function)

import os
import sys
from setuptools import setup

import versioneer

rootpath = os.path.abspath(os.path.dirname(__file__))

if sys.version_info < (3, 5):
error = """
folium 0.9+ supports Python 3.5 and above.
When using Python 2.7, please install folium 0.8.*.

See folium `README.rst` file for more information:

https://github.com/python-visualization/folium/blob/master/README.rst

Python {py} detected.

Try upgrading pip and retry.
""".format(py='.'.join([str(v) for v in sys.version_info[:3]]))
print(error, file=sys.stderr)
sys.exit(1)


def read(*parts):
return open(os.path.join(rootpath, *parts), 'r').read()
Expand Down Expand Up @@ -60,8 +77,6 @@ def walk_subpkg(name):
url='https://github.com/python-visualization/folium',
keywords='data visualization',
classifiers=[
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand All @@ -73,6 +88,7 @@ def walk_subpkg(name):
platforms="any",
packages=packages,
package_data=package_data,
python_requires='>=3.5',
extras_require={"testing": ["pytest"]},
install_requires=install_requires,
zip_safe=False,
Expand Down