Skip to main content

Read-only Textual viewer for HDF5 files

Project description

viewh5

PyPI License

Read-only, keyboard-first HDF5 viewer built with Textual.

viewh5 demo

Install

uv tool install viewh5

Or install the latest version directly from GitHub:

uv tool install --from git+https://github.com/kabilan108/viewh5 viewh5

Run it with viewh5 open path/to/file.h5.

For a non-interactive summary, use:

viewh5 describe path/to/file.h5

Yazi Previews

viewh5 can be used as both the HDF5 opener and the previewer in Yazi. The preview flow is built around piper.yazi, which runs viewh5 describe and shows the resulting text in Yazi's preview pane.

  1. Install viewh5 so the viewh5 command is on your PATH.
uv tool install viewh5
  1. Install the piper.yazi plugin:
ya pkg add yazi-rs/plugins:piper
  1. Add the opener and preview rules to ~/.config/yazi/yazi.toml:
[opener]
h5 = [
  { run = 'viewh5 open "$@"', block = true, desc = "View HDF5 file" },
]

[open]
prepend_rules = [
  { url = "*.h5", use = [ "h5" ] },
  { url = "*.hdf5", use = [ "h5" ] },
  { url = "*.hdf", use = [ "h5" ] },
]

[plugin]
prepend_previewers = [
  { url = "*.h5", run = 'piper -- viewh5 describe --width "$w" --height "$h" "$1"' },
  { url = "*.hdf5", run = 'piper -- viewh5 describe --width "$w" --height "$h" "$1"' },
  { url = "*.hdf", run = 'piper -- viewh5 describe --width "$w" --height "$h" "$1"' },
]

After restarting Yazi, open on an HDF5 file will launch the full Textual app and hovering an HDF5 file will show the text summary in the preview pane.

Home Manager Setup

If you manage Yazi with Home Manager, the relevant configuration looks like:

programs.yazi = {
  enable = true;
  enableBashIntegration = true;
  plugins = {
    piper = pkgs.yaziPlugins.piper;
  };
  settings = {
    opener = {
      h5 = [
        { run = ''viewh5 open "$@"''; block = true; desc = "View HDF5 file"; }
      ];
    };
    open = {
      prepend_rules = [
        { url = "*.h5"; use = [ "h5" ]; }
        { url = "*.hdf5"; use = [ "h5" ]; }
        { url = "*.hdf"; use = [ "h5" ]; }
      ];
    };
    plugin = {
      prepend_previewers = [
        { url = "*.h5"; run = ''piper -- viewh5 describe --width "$w" --height "$h" "$1"''; }
        { url = "*.hdf5"; run = ''piper -- viewh5 describe --width "$w" --height "$h" "$1"''; }
        { url = "*.hdf"; run = ''piper -- viewh5 describe --width "$w" --height "$h" "$1"''; }
      ];
    };
  };
};

After rebuilding Home Manager, open on an HDF5 file will launch the full Textual app and hovering an HDF5 file will show the text summary in Yazi's preview pane.

Development

uv sync
uv run pytest
uv run ruff check
uv run ty check
uv run viewh5 open data/1520.h5
vhs assets/viewh5-demo.tape

To update snapshots after making changes to the TUI:

uv run pytest tests/test_snapshots.py --snapshot-update

To recreate the demo, make sure the project environment is synced and data/waveforms.h5 is present, then run vhs assets/viewh5-demo.tape.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viewh5-0.3.0.tar.gz (595.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viewh5-0.3.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file viewh5-0.3.0.tar.gz.

File metadata

  • Download URL: viewh5-0.3.0.tar.gz
  • Upload date:
  • Size: 595.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for viewh5-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cbce8be050e18b1b1719be79c730d574a35865d5e12fbb81a99c77b54d568e62
MD5 0bd7799024033cd8204703d94de3359b
BLAKE2b-256 db2dfe7e23ccddca240fcd6dfade1b188e7ea0204db8f458cb8bd5fb72ab97de

See more details on using hashes here.

File details

Details for the file viewh5-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: viewh5-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for viewh5-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 355e0506a2ccf0b7f8343bd214f7abf4a5f85b9c20e860b0f4f4c9e45c4a083c
MD5 779282997e2ccdd1c637f16ed456d8ea
BLAKE2b-256 d1dc616892478e05b1da79d06dcff51a68a44b50a64bda38c078256332688f57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page