Files
eco/docs/command_history.md
Henrik Lemke 98d8e4a0c5 docs: "Did you know?" tips, pages for recent features, and a docs-site job
- docs/did_you_know/: one short tip per feature added since May 2026
  (<date>-<slug>.md, YAML front matter: added/tags/details), listed
  newest first; index.md describes the format for adding more.
- New pages for features that had none: launching, command_history,
  tab_completion, live_gui, tweak, scanning, status_server,
  channel_access, shared_files, schematic_panels. Wired into index.rst
  together with the existing queues page.
- Fix archiver_stripchart/listening_monitor: the method is
  archiver.strip_plot (strip_chart does not exist on DataHub); document
  the per-device .strip_plot().
- NAMESPACE_MONITOR_FORMAT.md: scan monitoring is wired into Daq's scan
  callbacks since 2026-09-09.
- scripts/eco-docs (+ -install-user-service): build the docs from an own
  clone and serve them over HTTP as user systemd units, rebuilt by a
  timer; a failed build never replaces the served site.
2026-10-25 14:26:52 +01:00

3.3 KiB

Command history, the Log Viewer and the ... picker

Every eco console keeps a full record of what was typed and what came back. eco uses that record to show you a searchable timeline, to give you your most recent and most used commands, and to offer them in an inline picker.

What is logged

Every console opened through eco is logged automatically, input and output, as JSON lines under ~/.eco/kernel_logs/. That covers the eco terminal session, the desktop console, eco.start_console(), and JupyterLab/Voila kernels.

If you use eco as a plain library (from eco import bernina in your own IPython), switch it on yourself:

from eco import globallogger
globallogger.start()          # optional: label="my analysis", log_dir=...

The Log Viewer

eco.logs.widget()             # timeline of every session's commands
eco.logs.tail(20)             # the last 20 entries, as text

The viewer opens as a Qt window when there is a usable Qt session, renders inline in Jupyter, or is written to an HTML file otherwise (prefer="qt"|"html"|"webapp" forces one). It is zoomable and filterable, can show several sessions at once, and has Copy Selected as Script, which turns the entries you select back into runnable code. In the desktop it is also under Tools → Log Viewer, and the JupyterLab/Voila dashboards have a Log Viewer button.

Recent and frequent commands

eco.logs.recent_commands(20)      # most recent first, de-duplicated
eco.logs.frequent_commands(20)    # ranked by how often you used them

The ... picker

In an eco session, a bare ... written where an expression belongs means "let me pick something here". It is switched on by default in the eco session.

In the terminal: ... + Tab

In [1]: (1 / ...<TAB>
          bernina.mono.energy               recent
          bernina.attenuator.transmission   recommended
          bernina.slit1.width               namespace

Tab opens IPython's own completion menu with three sections:

  • Recent: what you picked last.
  • Recommended: what you use most, counted per user and namespace.
  • Namespace: a live walk of the whole namespace tree.

Typing after the trigger (...ene<TAB>) narrows the namespace section by substring.

...h<TAB> does the same for your previous commands instead of components.

In both cases the pick is only inserted at the cursor. Nothing runs until you press Enter on the finished line yourself.

Press Enter: the Qt picker

If a ... is still in the line when you press Enter, a small picker window opens with two tabs, Components and Commands:

In [1]: (1 / ...).plot()
        <pick "mono.energy", press Enter>
In [2]: (1 / bernina.mono.energy).plot()     <- pre-filled, not yet run

The expanded line is placed at the next prompt for you to check, edit or just submit. If a line has several ..., each one asks in turn, left to right. A single click only highlights a row; picking takes Enter, a double-click or Go. Closing the picker leaves the literal ... in place.

arr[...] (numpy's Ellipsis subscript) is left alone. Without a display, an unexpanded ... reaching Enter prints a message instead of opening the picker.

In a library session, turn it on and off yourself:

from eco import ipymagic
ipymagic.start(bernina)
ipymagic.stop()