Skip to main content

A Python package for HoloViz utilities

Project description

holoviz-utils

A Python package for HoloViz utilities.

Installation

pip install -e .

For development:

pip install -e ".[dev]"

Usage

import holoviz_utils

Caption templates

DataPresentation renders the __doc__ of its components — and its title / introduction / conclusion params — as live captions. Any {...} token is substituted against current parameter values and re-rendered automatically whenever a referenced value changes.

A token is {[func(]param[keys][:fmt])} (only param is required):

  • param — a parameter name, resolved on the presentation or any reachable sub-object (a DataCombiner, a layer, a colormap, …).
  • [keys] — index/key lookups. A quoted key (['label']) is literal; an unquoted key ([highlight_name]) is another param ref whose value is used as the key — this is how you turn a code into a display name.
  • func(...) — an optional whitelisted function (len, sum, min, max, abs, round, sorted, int, float, str, bool).
  • :fmt — an optional Python format spec (:0.1f, :,, %Y-%m-%d, …).

A token that resolves to None renders as unknown.

# highlight_name == "Q"; cmap_var_styles == {"Q": {"label": "Discharge (m³/s)"}, ...}
dgl.__doc__ = (
    "Time-series for the {cmap_var_styles[highlight_name]['label']} at the "
    "{click_state['properties']['S6_SB_NAME']} sub-basin."
)
# -> "Time-series for the Discharge (m³/s) at the <name> sub-basin."

"{len(subbasins)} sub-basins selected"   # -> "3 sub-basins selected"
"mean = {max(scores['a']):0.2f}"          # -> "mean = 12.34"

To add a code -> display mapping, just expose it as a parameter and reference {table[code_param]['field']} — no derived params or manual watchers needed. See DataPresentation.update_doc for the full reference.

Development

Run tests:

pytest

License

MIT

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

holoviz_utils-0.5.8.tar.gz (841.1 kB view details)

Uploaded Source

Built Distribution

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

holoviz_utils-0.5.8-py3-none-any.whl (781.3 kB view details)

Uploaded Python 3

File details

Details for the file holoviz_utils-0.5.8.tar.gz.

File metadata

  • Download URL: holoviz_utils-0.5.8.tar.gz
  • Upload date:
  • Size: 841.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for holoviz_utils-0.5.8.tar.gz
Algorithm Hash digest
SHA256 5a593ec3665a8b4d3fca39c8e3288a937f82f27ac087b1e3b9c1f523db6568c8
MD5 994e00b6fbc7cfd43533b29198ddf6cc
BLAKE2b-256 f4e4ca6ee214e376412480be6133f0206596c1c4fa8fe9b9715bf12d947ce492

See more details on using hashes here.

Provenance

The following attestation bundles were made for holoviz_utils-0.5.8.tar.gz:

Publisher: release.yml on bertcoerver/holoviz-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file holoviz_utils-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: holoviz_utils-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 781.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for holoviz_utils-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 942f09a6c6ed87ae3af8bcceb15bce57d726ff48304b381722627d2d163d8300
MD5 dbfad45be2487af51299e975857feca2
BLAKE2b-256 fe77b4a7b233ec5006a3eb037eb08115865bdeb8952b15fd5c88d37a8e1e06c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for holoviz_utils-0.5.8-py3-none-any.whl:

Publisher: release.yml on bertcoerver/holoviz-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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