evidential 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
evidential/__init__.py ADDED
@@ -0,0 +1,110 @@
1
+ """Evidence-style interactive tables for Marimo.
2
+
3
+ A small anywidget wrapper around a hand-written renderer that mirrors the
4
+ formatting, conditional visualisation, grouping and interaction of
5
+ `Evidence.dev <https://evidence.dev>`_ tables.
6
+
7
+ Quick start::
8
+
9
+ import duckdb
10
+ from evidential import EvidentialTable
11
+
12
+ con = duckdb.connect()
13
+ con.execute("INSTALL httpfs; LOAD httpfs;")
14
+ con.execute(
15
+ "CREATE VIEW trips AS SELECT * FROM "
16
+ "'https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-01.parquet'"
17
+ )
18
+
19
+ EvidentialTable(
20
+ con.sql("SELECT * FROM trips LIMIT 500"),
21
+ title="NYC yellow taxi trips",
22
+ search=True,
23
+ page_size=15,
24
+ column_config={
25
+ "trip_distance": {"fmt": "num1"},
26
+ "fare_amount": {"fmt": "usd", "viz": "bar"},
27
+ "tip_amount": {"fmt": "usd", "viz": "color", "color_scale": ["#fee2e2", "#16a34a"]},
28
+ },
29
+ )
30
+ """
31
+
32
+ from . import col, domain, duck, label, rows
33
+ from ._column import CURRENCY_CODES, Column, ColumnGroup
34
+ from ._domain import Domain
35
+ from ._label import Label
36
+ from .aggregations import BUILTIN_AGGREGATIONS, apply_aggregations, resolve_aggregation
37
+ from .client import grouped_records
38
+ from .comparison import comparison_table
39
+ from .configuration import ColumnOptions, SparklineType, TableOptions, settings
40
+ from .data import make_column
41
+ from .grouped import grouped_table, simple_table
42
+ from .live import LiveEvidentialTable, query_values
43
+ from .pivot import pivot_table
44
+ from .query import date_range_sql, query_table
45
+ from .rows import Rows
46
+ from .rules import (
47
+ cells_body,
48
+ cols_merge,
49
+ cols_merge_n_pct,
50
+ cols_merge_range,
51
+ cols_merge_uncert,
52
+ resolve_rules,
53
+ sub_large_vals,
54
+ sub_missing,
55
+ sub_small_vals,
56
+ sub_values,
57
+ sub_zero,
58
+ tab_format,
59
+ tab_style,
60
+ text_transform,
61
+ )
62
+ from .table import EvidentialTable, section_row, spacer_row
63
+
64
+ __all__ = [
65
+ "TableOptions",
66
+ "ColumnOptions",
67
+ "SparklineType",
68
+ "col",
69
+ "label",
70
+ "domain",
71
+ "Domain",
72
+ "Label",
73
+ "Column",
74
+ "ColumnGroup",
75
+ "rows",
76
+ "Rows",
77
+ "CURRENCY_CODES",
78
+ "settings",
79
+ "EvidentialTable",
80
+ "section_row",
81
+ "spacer_row",
82
+ "LiveEvidentialTable",
83
+ "grouped_table",
84
+ "grouped_records",
85
+ "pivot_table",
86
+ "comparison_table",
87
+ "query_table",
88
+ "date_range_sql",
89
+ "BUILTIN_AGGREGATIONS",
90
+ "resolve_aggregation",
91
+ "apply_aggregations",
92
+ "cells_body",
93
+ "tab_style",
94
+ "tab_format",
95
+ "text_transform",
96
+ "sub_missing",
97
+ "sub_zero",
98
+ "sub_small_vals",
99
+ "sub_large_vals",
100
+ "sub_values",
101
+ "cols_merge",
102
+ "cols_merge_range",
103
+ "cols_merge_uncert",
104
+ "cols_merge_n_pct",
105
+ "resolve_rules",
106
+ "simple_table",
107
+ "query_values",
108
+ "make_column",
109
+ "duck",
110
+ ]
evidential/_aliases.py ADDED
@@ -0,0 +1,22 @@
1
+ """Small, shared public-option alias handling; wire names remain stable."""
2
+
3
+ from typing import Any
4
+
5
+
6
+ def alias(options: dict[str, Any], canonical: str, compatibility: str) -> None:
7
+ """Move an alias to its canonical key, rejecting conflicting declarations."""
8
+ if compatibility not in options:
9
+ return
10
+ value = options.pop(compatibility)
11
+ if value is None:
12
+ return
13
+ if options.get(canonical) is not None and options[canonical] != value:
14
+ raise ValueError(f"{canonical} and {compatibility} disagree")
15
+ options[canonical] = value
16
+
17
+
18
+ def format_code(format: str | None, fmt: str | None) -> str | None:
19
+ """Resolve the public ``format`` spelling and its ``fmt`` compatibility alias."""
20
+ options = {"fmt": fmt, "format": format}
21
+ alias(options, "fmt", "format")
22
+ return options.get("fmt")