Skip to main content

✨ panel-mosaic

CI conda-forge pypi-version python-version

Interactive, DuckDB-powered Mosaic visualizations for Panel.

Build linked, browser-interactive charts without embedding an entire dataset in the page. Mosaic sends SQL to DuckDB and returns only the results each view needs.

Why panel-mosaic?

  • Declarative charts: Render Mosaic and vgplot specifications directly in a Panel app.
  • DuckDB pushdown: Keep large tables in DuckDB; only query results travel to the browser.
  • Linked exploration: Coordinate multiple charts with selections and cross-filtering.

Installation

The PyPI distribution is named panel-mosaic-viz:

pip install panel-mosaic-viz

Quick start

Create app.py with a small DuckDB table and a stacked bar chart:

import duckdb
import panel as pn

from panel_mosaic import Mosaic

pn.extension(sizing_mode="stretch_width")

con = duckdb.connect()
con.execute("""
    CREATE TABLE monthly_revenue AS
    SELECT * FROM (
        VALUES
            ('Jan', 'North', 48), ('Jan', 'Central', 39), ('Jan', 'South', 42),
            ('Feb', 'North', 55), ('Feb', 'Central', 45), ('Feb', 'South', 49),
            ('Mar', 'North', 46), ('Mar', 'Central', 40), ('Mar', 'South', 44),
            ('Apr', 'North', 61), ('Apr', 'Central', 48), ('Apr', 'South', 52),
            ('May', 'North', 65), ('May', 'Central', 52), ('May', 'South', 56),
            ('Jun', 'North', 58), ('Jun', 'Central', 47), ('Jun', 'South', 50),
            ('Jul', 'North', 72), ('Jul', 'Central', 55), ('Jul', 'South', 58),
            ('Aug', 'North', 66), ('Aug', 'Central', 52), ('Aug', 'South', 54),
            ('Sep', 'North', 79), ('Sep', 'Central', 60), ('Sep', 'South', 64),
            ('Oct', 'North', 89), ('Oct', 'Central', 69), ('Oct', 'South', 70),
            ('Nov', 'North', 74), ('Nov', 'Central', 58), ('Nov', 'South', 60),
            ('Dec', 'North', 85), ('Dec', 'Central', 66), ('Dec', 'South', 69)
    ) AS t(month, region, revenue)
""")

spec = {
    "width": 900,
    "height": 480,
    "marginLeft": 72,
    "marginBottom": 48,
    "xLabel": "Month",
    "yLabel": "Revenue (USD thousands)",
    "yGrid": "#e5e7eb",
    "colorScheme": "Tableau10",
    "plot": [{
        "mark": "barY",
        "data": {"from": "monthly_revenue"},
        "x": "month",
        "y": "revenue",
        "fill": "region",
        "stroke": "white",
        "strokeWidth": 1,
    }],
}

pn.Column(
    "# Monthly revenue dashboard",
    "Explore regional revenue with a Mosaic chart backed by DuckDB.",
    Mosaic(spec, con=con),
).servable()

Run the app:

panel serve app.py --show

Monthly revenue chart rendered with panel-mosaic

How it works

Mosaic is a Panel JSComponent. It renders the declarative chart specification in the browser and services Mosaic's SQL requests through its DuckDB connection. You can either pass an existing DuckDB connection with con= or register in-memory frames with data={"table_name": dataframe}.

See the documentation for API details and more examples.

Development

git clone https://github.com/panel-extensions/panel-mosaic
cd panel-mosaic

For a simple setup use uv:

uv venv
source .venv/bin/activate # on linux. Similar commands for windows and osx
uv pip install -e .[dev]
pre-commit run install
pytest tests

For the full Github Actions setup use pixi:

pixi run pre-commit-install
pixi run postinstall
pixi run test

This repository is based on copier-template-panel-extension (you can create your own Panel extension with it)!

To update to the latest template version run:

pixi exec --spec copier --spec ruamel.yaml -- copier update --defaults --trust

Note: copier will show Conflict for files with manual changes during an update. This is normal. As long as there are no merge conflict markers, all patches applied cleanly.

❤️ Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Make your changes and commit them: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

Please ensure your code adheres to the project's coding standards and passes all tests.

Metadata

Release files for panel-mosaic-viz 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for panel-mosaic-viz 0.1.4
File Size Uploaded
panel_mosaic_viz-0.1.4.tar.gz 219.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for panel-mosaic-viz 0.1.4
File Interpreter ABI Platform
panel_mosaic_viz-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 230.1 kB

Release files / panel_mosaic_viz-0.1.4.tar.gz

Download URL panel_mosaic_viz-0.1.4.tar.gz
Size 219.6 kB
Tags Source
SHA-256 checksum
How to use checksums
77da217f7fd2aa3ed60e16239a1adfa89784289ef788e7fe96761262e2495bce
BLAKE2b-256 checksum
How to use checksums
b7af330b900b5448875cfdf9560ca2ddf1f51bb8a189cd9a8df1cb8749c0fc56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / panel_mosaic_viz-0.1.4-py3-none-any.whl

Download URL panel_mosaic_viz-0.1.4-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0d59bde9db0b8a1dcc0a8a0f42952f1a8d58dc415d77b40f2bf58a6a5e71538
BLAKE2b-256 checksum
How to use checksums
4df08ff3b5dad6507c6bae3e8f469f2cad41e6be600594d2837c9d5731f4e716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.5

2 release files

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page