plotui 0.5.1__cp39-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plotui/__init__.py ADDED
@@ -0,0 +1,47 @@
1
+ """plotui — interactive 2D/3D terminal plots.
2
+
3
+ The heavy lifting (data model, 3D camera, rasterization) lives in a Rust core
4
+ exposed as the native ``plotui._plotui`` module. Python owns the event loop and
5
+ input; the native side is a stateless-ish rendering engine.
6
+
7
+ Quick start::
8
+
9
+ from plotui import Plot
10
+ plot = Plot()
11
+ h = plot.add_line(xs, ys, name="forecast") # 2D: axes/ticks/legend appear
12
+ plot.add_line(xs, costs, axis="y2") # independent right-hand axis
13
+ plot.add_line(xs, temps, color="red") # shorthands: "red", "#e63c78"
14
+ plot.set_colorway("vivid") # or a list of colors
15
+ plot.add_scatter3d(xs, ys, zs, name="A") # any 3D trace -> orbit camera
16
+ plot.add_line3d(xs, ys, zs) # 3D trajectory/curve
17
+ plot.add_surface3d(xs, ys, Z) # grid surface, viridis by default
18
+ plot.extend(h, more_xs, more_ys) # stream data by trace handle
19
+
20
+ Pipelines and DAGs::
21
+
22
+ from plotui import LayeredLayout, Plot, from_dot, reachable
23
+ plot = from_dot("digraph { fetch -> clean -> publish }") # a DOT subset
24
+ # or lay one out yourself and colour it live:
25
+ layout = LayeredLayout(n_nodes, edges) # rankdir="TB" or "LR"
26
+ xs, ys = layout.positions()
27
+ h = plot.add_graph2d(xs, ys, edges, labels=names,
28
+ routes=layout.routes())
29
+ plot.set_graph_colors(h, states) # repaint as the run advances
30
+ lit = reachable(n_nodes, edges, hovered) # everything it waits on
31
+ # In a raw loop: escape = plot.render_kitty(cols, rows, cell_w, cell_h)
32
+ # In Textual: use plotui.textual.PlotWidget(plot)
33
+ """
34
+
35
+ from ._plotui import (
36
+ ForceLayout,
37
+ LayeredLayout,
38
+ Plot,
39
+ __version__,
40
+ from_dot,
41
+ reachable,
42
+ )
43
+
44
+ # `__version__` comes from the native module, which takes it from the crate:
45
+ # one number for the whole build. Repeating it here is how it drifted to
46
+ # 0.3.0 while the crates were on 0.4.2.
47
+ __all__ = ["ForceLayout", "LayeredLayout", "Plot", "__version__", "from_dot", "reachable"]
plotui/_bin/plotui.exe ADDED
Binary file
plotui/_cli.py ADDED
@@ -0,0 +1,33 @@
1
+ """The `plotui` console script: exec the bundled native CLI binary.
2
+
3
+ Prebuilt wheels carry the compiled CLI at ``plotui/_bin/plotui`` (``.exe``
4
+ on Windows); this
5
+ entry point replaces the Python process with it, so ``plotui`` on the
6
+ command line *is* the native binary. Source builds don't bundle it.
7
+ """
8
+
9
+ import os
10
+ import sys
11
+
12
+
13
+ def main() -> None:
14
+ name = "plotui.exe" if sys.platform == "win32" else "plotui"
15
+ exe = os.path.join(os.path.dirname(__file__), "_bin", name)
16
+ if not os.path.exists(exe):
17
+ sys.stderr.write(
18
+ "plotui: this install does not bundle the CLI (source builds don't).\n"
19
+ "Use a prebuilt wheel, or another install method: https://plotui.xyz/#install\n"
20
+ )
21
+ raise SystemExit(1)
22
+ argv = [exe, *sys.argv[1:]]
23
+ if sys.platform == "win32":
24
+ # Windows has no exec: os.execv would spawn and detach, leaving the
25
+ # console to the shell while the CLI still reads it
26
+ import subprocess
27
+
28
+ raise SystemExit(subprocess.call(argv))
29
+ try:
30
+ os.execv(exe, argv)
31
+ except PermissionError:
32
+ os.chmod(exe, 0o755)
33
+ os.execv(exe, argv)
plotui/_plotui.pyd ADDED
Binary file