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.2.tar.gz (764.1 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.2-py3-none-any.whl (791.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grid_view_spec-2.0.2.tar.gz
  • Upload date:
  • Size: 764.1 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.2.tar.gz
Algorithm Hash digest
SHA256 8339bcff386d33c12605c9e8a19587a85c9b747f02cba66f4db95ed77c304430
MD5 3942cb3ba7c54c47f3569f52f43db956
BLAKE2b-256 53b99eec161c07544ba516017035afc69b2836a96d71127e271b745f2845c134

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: grid_view_spec-2.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 494d8f5d6e3575a96524f815c48d38c1d1c7980223339be3152775abd685522a
MD5 574a50eb81e3aa1647478ef11709001f
BLAKE2b-256 e01cc84af46d43aa1fe9e5fa59e94fe275c3cf84da6731446353daa21ee79dc0

See more details on using hashes here.

Provenance

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

This release

2.0.2 This release

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