Declarative GridViewSpec pages: tables, filters, KPI, charts, PDF/XLSX export; optional Django backend
Project description
Grid View Spec
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) # 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-Grid —
GridViewTable(backend="ag_grid")+ host JSON API; helpers ingrid_view_spec.backends.django.ag_grid - Charts / KPI — spec blocks + ECharts; values always from host
rows - MCP —
gridviewspec-mcpfor 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grid_view_spec-2.0.0.tar.gz.
File metadata
- Download URL: grid_view_spec-2.0.0.tar.gz
- Upload date:
- Size: 759.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
095727806253422d79d10fb98c690b06c72851e00a3892cc4639bc3a10ee4af6
|
|
| MD5 |
39284fdc38b4e798cbbb43e97614ee0d
|
|
| BLAKE2b-256 |
d5febb53f8e36c702c0e4abd3c67e684e684056b793ccca49408350fc2c80552
|
Provenance
The following attestation bundles were made for grid_view_spec-2.0.0.tar.gz:
Publisher:
ci.yml on alpiua/grid-view-spec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grid_view_spec-2.0.0.tar.gz -
Subject digest:
095727806253422d79d10fb98c690b06c72851e00a3892cc4639bc3a10ee4af6 - Sigstore transparency entry: 1936969482
- Sigstore integration time:
-
Permalink:
alpiua/grid-view-spec@0b6e3323be1124ba0198ccf98cf8145697771acd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/alpiua
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0b6e3323be1124ba0198ccf98cf8145697771acd -
Trigger Event:
push
-
Statement type:
File details
Details for the file grid_view_spec-2.0.0-py3-none-any.whl.
File metadata
- Download URL: grid_view_spec-2.0.0-py3-none-any.whl
- Upload date:
- Size: 788.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
368bb0bd19192be309347fb071ead0ca34f09892eb1c2d3c6a87d386d291f0be
|
|
| MD5 |
6263f4c695a8e8a1c170f6954e6c822e
|
|
| BLAKE2b-256 |
41f2cc6048fa7ef237a548011874e09d8239d34d2d4e74ce616a692dd96973a0
|
Provenance
The following attestation bundles were made for grid_view_spec-2.0.0-py3-none-any.whl:
Publisher:
ci.yml on alpiua/grid-view-spec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grid_view_spec-2.0.0-py3-none-any.whl -
Subject digest:
368bb0bd19192be309347fb071ead0ca34f09892eb1c2d3c6a87d386d291f0be - Sigstore transparency entry: 1936969556
- Sigstore integration time:
-
Permalink:
alpiua/grid-view-spec@0b6e3323be1124ba0198ccf98cf8145697771acd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/alpiua
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0b6e3323be1124ba0198ccf98cf8145697771acd -
Trigger Event:
push
-
Statement type: