Python bokeh.__version__() Examples

The following are 4 code examples of bokeh.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bokeh , or try the search function .
Example #1
Source File: __init__.py    From arviz with Apache License 2.0 5 votes vote down vote up
def check_bokeh_version():
    """Check minimum bokeh version."""
    try:
        import bokeh

        assert version.parse(bokeh.__version__) >= version.parse("1.4.0")
    except (ImportError, AssertionError):
        raise ImportError("'bokeh' backend needs Bokeh (1.4.0+) installed.") 
Example #2
Source File: app.py    From minimal-flask-example with MIT License 5 votes vote down vote up
def bokehplot():
    figure = make_plot()
    fig_script, fig_div = components(figure)
    return render_template(
        "bokeh.html.j2",
        fig_script=fig_script,
        fig_div=fig_div,
        bkversion=bokeh.__version__,
    ) 
Example #3
Source File: geoplot.py    From Pandas-Bokeh with MIT License 5 votes vote down vote up
def _get_background_tile(provider_name):
    """Returns a Bokeh WTMS Tile Provider Source from <provider_name>. If 
    <provider_name is not valid, it returns False."""

    if provider_name not in TILE_PROVIDERS:
        return False

    if bokeh.__version__ >= "1.1":
        from bokeh.tile_providers import get_provider

        return get_provider(provider_name)
    else:
        from bokeh.tile_providers import (
            CARTODBPOSITRON,
            CARTODBPOSITRON_RETINA,
            STAMEN_TERRAIN,
            STAMEN_TERRAIN_RETINA,
            STAMEN_TONER,
            STAMEN_TONER_BACKGROUND,
            STAMEN_TONER_LABELS,
        )

        tile_dict = {
            "CARTODBPOSITRON": CARTODBPOSITRON,
            "CARTODBPOSITRON_RETINA": CARTODBPOSITRON_RETINA,
            "STAMEN_TERRAIN": STAMEN_TERRAIN,
            "STAMEN_TERRAIN_RETINA": STAMEN_TERRAIN_RETINA,
            "STAMEN_TONER": STAMEN_TONER,
            "STAMEN_TONER_BACKGROUND": STAMEN_TONER_BACKGROUND,
            "STAMEN_TONER_LABELS": STAMEN_TONER_LABELS,
        }

        return tile_dict[provider_name] 
Example #4
Source File: plot_utils.py    From arviz with Apache License 2.0 4 votes vote down vote up
def get_plotting_function(plot_name, plot_module, backend):
    """Return plotting function for correct backend."""
    _backend = {
        "mpl": "matplotlib",
        "bokeh": "bokeh",
        "matplotlib": "matplotlib",
    }

    if backend is None:
        backend = rcParams["plot.backend"]
    backend = backend.lower()

    try:
        backend = _backend[backend]
    except KeyError:
        raise KeyError(
            "Backend {} is not implemented. Try backend in {}".format(
                backend, set(_backend.values())
            )
        )

    if backend == "bokeh":
        try:
            import bokeh

            assert packaging.version.parse(bokeh.__version__) >= packaging.version.parse("1.4.0")

        except (ImportError, AssertionError):
            raise ImportError(
                "'bokeh' backend needs Bokeh (1.4.0+) installed." " Please upgrade or install"
            )

    # Perform import of plotting method
    # TODO: Convert module import to top level for all plots
    module = importlib.import_module(
        "arviz.plots.backends.{backend}.{plot_module}".format(
            backend=backend, plot_module=plot_module
        )
    )

    plotting_method = getattr(module, plot_name)

    return plotting_method