Example #1
0
def _build_js():
    from bokeh.ext import build
    print("Building custom models:")
    module_dir = os.path.join(os.path.dirname(__file__), "pcp")
    build(module_dir)
    if sys.platform != "win32":
        # npm can cause non-blocking stdout; so reset it just in case
        import fcntl
        flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL)
        fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
Example #2
0
def test_ext_commands(tmpdir) -> None:
    tmp = str(tmpdir.mkdir("bk_ext_01"))

    assert _names(tmp) == []

    assert ext.init(tmp, bokehjs_version="2.4.0") is True
    assert _names(tmp) == [
        "bokeh.ext.json",
        "index.ts",
        "package.json",
        "tsconfig.json",
    ]

    assert ext.build(tmp) is True
    assert _names(tmp) == [
        ".bokeh",
        "bokeh.ext.json",
        "dist",
        "index.ts",
        "node_modules",
        "package-lock.json",
        "package.json",
        "tsconfig.json",
    ]

    assert ext.init(tmp) is False
Example #3
0
 def invoke(self, args: Namespace) -> bool:
     return build(args.base_dir, rebuild=args.rebuild, debug=args.debug)
Example #4
0
""" The LaTeX example was derived from: http://matplotlib.org/users/usetex.html. """

import numpy as np
from scipy.special import jv

from bokeh.ext import build
from bokeh.palettes import Spectral4
from bokeh.plotting import figure, output_file, show
from latex_label import LatexLabel

build("latex_label")



output_file('latex_extension.html')

p = figure(title="LaTex Extension Demonstration", plot_width=800, plot_height=350,
           background_fill_color="#fafafa")
p.x_range.range_padding = 0

x = np.arange(0.0, 20.0, 0.02)

for i, n in enumerate([0, 1, 4, 7]):
    p.line(x, jv(n, x), line_width=3, color=Spectral4[i], alpha=0.8, legend_label="𝜈=%d" % n)

text = r"""
\text{Bessel Functions of the First Kind: }
J_\nu = \sum_{m=0}^{\infty}\frac{(-1)^m}{m!\ \Gamma(m+\nu+1)}
\left(\frac{x}{2}\right)^{2m+\nu}
"""
Example #5
0
 def setup_class(cls):
     base_dir = dirname(__file__)
     build(join(base_dir, "ext_package_no_main"), rebuild=True)
Example #6
0
 def setup_class(cls):
     base_dir = dirname(__file__)
     build(join(base_dir, "latex_label"), rebuild=True)
Example #7
0
""" The LaTeX example was derived from: http://matplotlib.org/users/usetex.html. """

import numpy as np
from scipy.special import jv

from bokeh.ext import build
from bokeh.palettes import Spectral4
from bokeh.plotting import figure, output_file, show
from latex_label import LatexLabel

if not build("latex_label"):
    raise RuntimeError("unable to build latex_label extension")

output_file('latex_extension.html')

p = figure(title="LaTex Extension Demonstration",
           plot_width=800,
           plot_height=350,
           background_fill_color="#fafafa")
p.x_range.range_padding = 0

x = np.arange(0.0, 20.0, 0.02)

for i, n in enumerate([0, 1, 4, 7]):
    p.line(x,
           jv(n, x),
           line_width=3,
           color=Spectral4[i],
           alpha=0.8,
           legend_label="𝜈=%d" % n)
Example #8
0
def _build_js():
    from bokeh.ext import build
    print("Building custom models:")
    package_dir = os.path.join(os.path.dirname(__file__), "pnbkext")
    build(package_dir)
Example #9
0
 def run(self):
     from bokeh.ext import build
     build(ipywidgets_bokeh_dir)
Example #10
0
 def invoke(self, args):
     return build(args.base_dir, rebuild=args.rebuild, debug=args.debug)