Skip to main content

Grid View Spec

PyPI Python Docs License: MIT

Declarative dashboard pages for Django and other hosts — tables, filters, KPI strips, charts, and export from one typed GridViewSpec contract. You own SQL/ORM rows; the package owns layout, templates, browser runtime, and PDF/XLSX pipelines.

Documentation · MCP server · PyPI


Core idea

Layer Owner
Data Host — querysets, aggregates, authorization
Spec GridViewSpec — blocks (GridViewTable, GridViewFilters, …) + layout
Render Package — Jinja/Django HTML, gridviewspec.min.js, export
from grid_view_spec import GridViewSpec, validate_spec
from grid_view_spec.types.layout import GridViewArea, GridViewLayout
from grid_view_spec.types.table_v2 import GridViewColumn, GridViewTable

spec = GridViewSpec(
    id="orders",
    blocks=(
        GridViewTable(
            id="orders_table",
            backend="simple",
            columns=(
                GridViewColumn(id="name", label="Customer", field="name"),
                GridViewColumn(id="amount", label="Amount", field="amount", type="currency"),
            ),
        ),
    ),
    layout=GridViewLayout(root=GridViewArea(id="root", blocks=("orders_table",))),
)
validate_spec(spec)
{% load grid_view_spec %}
{% grid_view_spec_assets part='css' %}
{% render_grid_view_spec spec rows %}
{% grid_view_spec_assets part='js' force_core=True %}

Install

pip install "grid-view-spec[django]"
# optional:
pip install "grid-view-spec[django,pdf,xlsx,mcp]"

Django

INSTALLED_APPS = ["grid_view_spec.backends.django"]
python manage.py migrate grid_view_spec_django
urlpatterns = [
    path("", include("grid_view_spec.backends.django.urls")),
]

See Getting started and Django integration.


Export

Register builders that return GridViewExportJob(spec, rows, table_id=…):

from grid_view_spec.export.registry import register_pdf_export, register_xlsx_export
from grid_view_spec.export.registry import GridViewExportJob

def register_exports():
    def builder(host, ctx):
        page = load_orders_page(ctx.request)  # same loader as HTML view
        return GridViewExportJob(spec=page.spec, rows=page.rows, table_id="orders_table")

    register_pdf_export("orders", builder)
    register_xlsx_export("orders", builder)

Browser links use ?builder=orders plus current filter query params. Details: Export page pattern.


AG-Grid, charts, MCP

  • AG-GridGridViewTable(backend="ag_grid") + host JSON API; helpers in grid_view_spec.backends.django.ag_grid
  • Charts / KPI — spec blocks + ECharts; values always from host rows
  • MCPgridviewspec-mcp for validation, catalog, migration hints (tools/mcp-server.md)

Development

uv sync
uv run pytest -q
uv run basedpyright --warnings src/grid_view_spec tests
cd frontend && npm run build && npm run typecheck

Pre-commit hooks: ruff, basedpyright, frontend typecheck/eslint, pytest.


License

MIT — see LICENSE.

Download files

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

Source Distribution

grid_view_spec-2.0.3.tar.gz (764.4 kB view details)

Uploaded Source

Built Distribution

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

grid_view_spec-2.0.3-py3-none-any.whl (791.2 kB view details)

Uploaded Python 3

File details

Details for the file grid_view_spec-2.0.3.tar.gz.

File metadata

  • Download URL: grid_view_spec-2.0.3.tar.gz
  • Upload date:
  • Size: 764.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for grid_view_spec-2.0.3.tar.gz
Algorithm Hash digest
SHA256 db111b9ab55eebcd2af3dd9d9876d7269f31084927206fb1f25a2eb4d3a96e1d
MD5 a70adf81b0daaa8c7261e3c8c9d1729a
BLAKE2b-256 a9e2049fd1413f46be8447efef0edd3528f3bc4dbfea16c286f338d9e3c2dc40

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_view_spec-2.0.3.tar.gz:

Publisher: ci.yml on alpiua/grid-view-spec

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

File details

Details for the file grid_view_spec-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: grid_view_spec-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 791.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for grid_view_spec-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 43d54b94eba2667f245c8b7b0567e70748ce92fac251ff6d58e567ebc90f3796
MD5 d25dcd9d454cf9e413bb0ac13deabcca
BLAKE2b-256 7028a9906d74657a65bbc1e3caab26234b504b1795aace828df9fd8dd9909e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_view_spec-2.0.3-py3-none-any.whl:

Publisher: ci.yml on alpiua/grid-view-spec

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

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 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