Skip to content

Commit

Permalink
Remove geopandas as an installation requirement
Browse files Browse the repository at this point in the history
closes #178
  • Loading branch information
has2k1 committed Sep 12, 2018
1 parent 7afa45d commit 24c4d3d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ install:
export MPLLOCALFREETYPE=1
pip install matplotlib --no-binary matplotlib
pip install scikit-misc
pip install geopandas
pip install -e .
fi
- |
Expand Down
3 changes: 3 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ API Changes
***********

- Plotnine 0.5.0 only supports Python 3.5 and higher
- geopandas has been removed as a requirement for installation. Users of
:class:`~plotnine.geoms.geom_map` will have to install it separately.
(:issue:`178`)

Bug Fixes
*********
Expand Down
18 changes: 11 additions & 7 deletions plotnine/geoms/geom_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from matplotlib.collections import PatchCollection, LineCollection
from descartes.patch import PolygonPatch

try:
import geopandas # noqa: F401
except ImportError:
HAS_GEOPANDAS = False
else:
HAS_GEOPANDAS = True

from ..doctools import document
from ..exceptions import PlotnineError
from ..utils import to_rgba, SIZE_FACTOR
from .geom import geom
from .geom_point import geom_point
Expand Down Expand Up @@ -40,14 +48,10 @@ class geom_map(geom):
legend_geom = 'polygon'

def __init__(self, *args, **kwargs):
import sys
if sys.version_info >= (3, 7, 0):
from ..exceptions import PlotnineError
if not HAS_GEOPANDAS:
raise PlotnineError(
"geom_map does not work on Python 3.7 "
"for more information see "
"https://github.com/has2k1/plotnine/issues/178 "
"https://github.com/jswhit/pyproj/issues/136 "
"geom_map requires geopandas. "
"Please install geopandas."
)
geom.__init__(self, *args, **kwargs)
# Almost all geodataframes loaded from shapefiles
Expand Down
9 changes: 0 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ def get_required_packages():
# 'geopandas >= 0.3.0',
'descartes >= 1.1.0'
]
# FIXME: Remove and uncomment above when pyproj supports
# Python 3.7
# https://github.com/has2k1/plotnine/issues/178
# https://github.com/jswhit/pyproj/issues/136
import sys
if sys.version_info < (3, 7, 0):
install_requires.extend([
'geopandas >= 0.3.0',
])
return install_requires


Expand Down

0 comments on commit 24c4d3d

Please sign in to comment.