#175
gdtest_sec_index_hero
OK
CONFIG
Section index pages with hero images: 2-col demos (mixed image + plain) and 1-col gallery (all images).
Section index hero cards: Demos section with 2-col image cards (4 featured + 6 plain links), Gallery section with 1-col image cards (index_columns: 1). Tests mixed image/plain and column options.
Build Mode
● Has great-docs.yml
This package ships a pre-supplied config.
The great-docs init step is skipped and
great-docs build uses the spec-defined configuration directly.
Tests specific config options and their rendered output.
Dimensions
N10
N10Section index hero cardssections
Source Files
demos/
01-starter-demo.qmd
--- title: Starter Demo description: A minimal example showing the basics of data processing. image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%234A90D9' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EStarter Demo%3C/text%3E%3C/svg%3E" --- # Starter Demo This demo walks through the most basic usage of the package. ```python from gdtest_sec_index_hero import process result = process([1, 2, None, 3], strict=True) print(result) # [1, 2, 3] ``` The `strict` parameter filters out `None` values, giving you a clean list.
02-advanced-demo.qmd
---
title: Advanced Demo
description: A comprehensive example with chained operations and validation.
image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%2342B883' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EAdvanced Demo%3C/text%3E%3C/svg%3E"
---
# Advanced Demo
This demo chains multiple operations together.
```python
from gdtest_sec_index_hero import process, summarize, validate
data = process([10, 20, None, 30, 40], strict=True)
stats = summarize(data)
print(stats) # {'count': 4, 'sum': 100, 'mean': 25.0}
schema = {'count': int, 'sum': int, 'mean': float}
assert validate(schema, stats)
```03-data-pipeline.qmd
---
title: Data Pipeline
description: Build a complete ETL pipeline from raw data to validated output.
image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%23E8853D' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EData Pipeline%3C/text%3E%3C/svg%3E"
---
# Data Pipeline
A step-by-step guide to building a data pipeline.
## Step 1: Extract
```python
raw = [100, None, 200, None, 300]
```
## Step 2: Transform
```python
from gdtest_sec_index_hero import process
clean = process(raw, strict=True) # [100, 200, 300]
```
## Step 3: Load
```python
from gdtest_sec_index_hero import summarize
output = summarize(clean)
print(output) # {'count': 3, 'sum': 600, 'mean': 200.0}
```04-visualization.qmd
---
title: Visualization
description: Create summary visualizations from processed data.
image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%237C4DFF' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EVisualization%3C/text%3E%3C/svg%3E"
---
# Visualization
After processing and summarizing data, you can visualize the results.
```python
from gdtest_sec_index_hero import process, summarize
data = process([5, 15, 25, 35, 45])
stats = summarize(data)
print(f"Mean: {stats['mean']}, Total: {stats['sum']}")
```
Use these summary statistics as input to your favorite plotting library.05-error-handling.qmd
---
title: Error Handling
description: Learn how to handle edge cases and invalid inputs gracefully.
---
# Error Handling
When working with real-world data you need to handle edge cases.
```python
from gdtest_sec_index_hero import process, validate
# Empty lists are handled cleanly
result = process([], strict=True)
print(result) # []
# Validation catches missing fields
assert not validate({'name': str}, {'age': 30})
```06-batch-processing.qmd
---
title: Batch Processing
description: Process multiple datasets in batch mode.
---
# Batch Processing
Process several datasets at once.
```python
from gdtest_sec_index_hero import process, summarize
datasets = [
[10, 20, 30],
[5, None, 15],
[100, 200, 300],
]
for ds in datasets:
clean = process(ds, strict=True)
print(summarize(clean))
```07-schema-patterns.qmd
---
title: Common Schema Patterns
description: Reusable validation schemas for typical data structures.
---
# Common Schema Patterns
Define reusable schemas for common record types.
```python
from gdtest_sec_index_hero import validate
user_schema = {'name': str, 'age': int}
event_schema = {'type': str, 'timestamp': float}
assert validate(user_schema, {'name': 'Alice', 'age': 30})
assert validate(event_schema, {'type': 'click', 'timestamp': 1.0})
```08-performance-tips.qmd
--- title: Performance Tips description: Optimize processing speed for large datasets. --- # Performance Tips Tips for working efficiently with large volumes of data. - Use `strict=False` (the default) when you know data is clean - Pre-validate schemas once, then batch-process records - Use `summarize()` to get aggregate stats without storing intermediates
09-integration-guide.qmd
--- title: Integration Guide description: Integrate the package with pandas, Polars, and other frameworks. --- # Integration Guide How to use this package alongside popular data frameworks. ## With plain Python ```python from gdtest_sec_index_hero import process result = process([1, 2, 3]) ``` ## Converting results The `summarize()` function returns a plain dict, making it easy to convert to any format you need.
10-custom-validators.qmd
---
title: Custom Validators
description: Build your own validation logic on top of the validate function.
---
# Custom Validators
Extend the built-in `validate()` with custom rules.
```python
from gdtest_sec_index_hero import validate
def validate_positive(record):
base_ok = validate({'value': int}, record)
return base_ok and record['value'] > 0
assert validate_positive({'value': 42})
assert not validate_positive({'value': -1})
```gallery/
01-real-time-dashboard.qmd
--- title: Real-Time Dashboard description: A live dashboard that processes streaming data and displays rolling statistics. image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%23E53935' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EReal-Time%3C/text%3E%3C/svg%3E" --- # Real-Time Dashboard This example shows a dashboard that consumes a data stream, processes each batch, and updates summary statistics in real time. ```python from gdtest_sec_index_hero import process, summarize # Simulate a streaming batch batch = [42, None, 87, 13, None, 65] clean = process(batch, strict=True) stats = summarize(clean) print(stats) ```
02-workflow-automation.qmd
---
title: Workflow Automation
description: An automated pipeline that validates, processes, and reports on incoming records.
image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%23009688' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EWorkflow%3C/text%3E%3C/svg%3E"
---
# Workflow Automation
Automate your data quality workflow end to end.
```python
from gdtest_sec_index_hero import validate, process, summarize
schema = {'value': int}
records = [{'value': 10}, {'value': 20}, {'value': 30}]
valid = [r for r in records if validate(schema, r)]
values = [r['value'] for r in valid]
clean = process(values, strict=True)
report = summarize(clean)
print(report)
```03-data-explorer.qmd
--- title: Data Explorer description: An interactive data exploration tool that lets you filter, summarize, and drill down. image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%237C4DFF' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EVisualization%3C/text%3E%3C/svg%3E" --- # Data Explorer Explore datasets interactively by processing subsets and reviewing statistics. ```python from gdtest_sec_index_hero import process, summarize dataset = [5, 10, 15, 20, 25, 30, 35, 40] # Filter to values above 15 subset = [x for x in process(dataset) if x > 15] print(summarize(subset)) ```
04-quality-report.qmd
---
title: Quality Report
description: Generate a comprehensive data quality report with validation summaries.
image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Crect fill='%234A90D9' width='600' height='300'/%3E%3Ctext x='300' y='160' text-anchor='middle' fill='white' font-size='28' font-family='sans-serif'%3EStarter Demo%3C/text%3E%3C/svg%3E"
---
# Quality Report
Produce a data quality report by validating every record.
```python
from gdtest_sec_index_hero import validate
schema = {'name': str, 'score': int}
records = [
{'name': 'Alice', 'score': 95},
{'name': 'Bob'},
{'name': 'Carol', 'score': 88},
]
passed = sum(1 for r in records if validate(schema, r))
print(f"{passed}/{len(records)} records valid")
```gdtest_sec_index_hero/
__init__.py
"""Test package for section index hero cards.""" from .core import process, summarize, validate __all__ = ["process", "summarize", "validate"]
core.py
"""Core processing functions."""
def process(data: list, *, strict: bool = False) -> list:
"""Process a list of values.
Parameters
----------
data : list
Input values to process.
strict : bool
If True, raise on invalid values.
Returns
-------
list
Processed values.
Examples
--------
>>> process([1, 2, 3])
[1, 2, 3]
"""
return [x for x in data if x is not None] if strict else list(data)
def summarize(values: list) -> dict:
"""Summarize a list of numeric values.
Parameters
----------
values : list
Numeric values to summarize.
Returns
-------
dict
Summary with count, sum, and mean.
Examples
--------
>>> summarize([10, 20, 30])
{'count': 3, 'sum': 60, 'mean': 20.0}
"""
n = len(values)
total = sum(values)
return {"count": n, "sum": total, "mean": total / n if n else 0}
def validate(schema: dict, record: dict) -> bool:
"""Validate a record against a schema.
Parameters
----------
schema : dict
Expected field names mapped to types.
record : dict
The record to validate.
Returns
-------
bool
True if the record conforms to the schema.
Examples
--------
>>> validate({"name": str}, {"name": "Alice"})
True
"""
for key, expected_type in schema.items():
if key not in record or not isinstance(record[key], expected_type):
return False
return TrueREADME.md
# gdtest-sec-index-hero Test package demonstrating enhanced section index pages with hero images. - **Demos**: 2-column layout with 4 featured image cards + 6 plain links - **Gallery**: 1-column layout with 4 full-width image cards
great-docs.yml
sections:
- title: Demos
dir: demos
index: true
- title: Gallery
dir: gallery
index: true
index_columns: 1
navbar_after: Demos