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.1.tar.gz (763.7 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.1-py3-none-any.whl (791.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grid_view_spec-2.0.1.tar.gz
  • Upload date:
  • Size: 763.7 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.1.tar.gz
Algorithm Hash digest
SHA256 0992626ec18ccdf4b4175dbbc4d2d5967471de01c416a67fe3e48d90c31176f6
MD5 a95341506cb3530a2c91ccc289a0a8a2
BLAKE2b-256 800d89eadd04d6eb7612ae215cb8cccce6512e63637009a194c9e0d584a30408

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_view_spec-2.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: grid_view_spec-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 791.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee48298624b92c3d1e34c3d550aa1b1f11b515270a782ae2008042addef6b7fb
MD5 aed9553ee34cf8c862586c74b30059fd
BLAKE2b-256 22cccb114f8ee7c3d33872240d09bd94c6587058ce3f7c98f9b504a77592b98e

See more details on using hashes here.

Provenance

The following attestation bundles were made for grid_view_spec-2.0.1-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

2.0.3

2 files

2.0.2

2 files

This release

2.0.1 This release

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