Skip to content

Less boilerplate for optional dependencies#280

Closed
ocefpaf wants to merge 1 commit intopython-visualization:masterfrom
ocefpaf:lazy_import
Closed

Less boilerplate for optional dependencies#280
ocefpaf wants to merge 1 commit intopython-visualization:masterfrom
ocefpaf:lazy_import

Conversation

@ocefpaf
Copy link
Copy Markdown
Member

@ocefpaf ocefpaf commented Dec 4, 2015

This PR reduces the amount of code when adding an optional dependency. I do not think we have anything like this outside folium/utilities.py.

I think we should follow this simpler pattern in the future.

@ocefpaf ocefpaf added this to the v0.2.0 milestone Dec 4, 2015
@ocefpaf
Copy link
Copy Markdown
Member Author

ocefpaf commented Dec 4, 2015

@BibMartin this is not aimed to close #241 per se. But let me know if you are OK with this as a strategy deal with optional dependencies.

@BibMartin
Copy link
Copy Markdown
Contributor

@ocefpaf
I'm not fully okay with this strategy. I'd prefer if the buggy functions were isolated into a plugin.
For example, I guess ImageOverlay would need to be a plugin (or at least the array->image part), so that the plugins would be tagged numpy dependent, while there's no risk of facing a bug when using classical folium.

@ocefpaf
Copy link
Copy Markdown
Member Author

ocefpaf commented Dec 5, 2015

I'm not fully okay with this strategy. I'd prefer if the buggy functions were isolated into a plugin.
For example, I guess ImageOverlay would need to be a plugin (or at least the array->image part), so that the plugins would be tagged numpy dependent, while there's no risk of facing a bug when using classical folium.

That is better. Still, even as isolated plugins, I'd rather we import inside the function and let the ImportError be raised, than suffering the risk of a rogue import somewhere triggering the optimal dependency.

We can close this, leave as-is, and open another issue to isolated things. Or we can merge this, ship v0.2.0 and work on isolating things in v0.2.1. Your call. I am fine either way.

@themiurgo
Copy link
Copy Markdown
Contributor

I'm with @BibMartin for long-term strategy on this.

@ocefpaf ocefpaf closed this Jan 15, 2016
@ocefpaf ocefpaf deleted the lazy_import branch January 15, 2016 17:19
@ocefpaf
Copy link
Copy Markdown
Member Author

ocefpaf commented Jan 15, 2016

I closed this. We'll follow with @BibMartin's strategy.

@ocefpaf ocefpaf added the enhancement Feature request or idea about how to make folium better label Feb 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request or idea about how to make folium better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants