chartcraft 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.
chartcraft/__init__.py ADDED
@@ -0,0 +1,202 @@
1
+ """
2
+ ◆ ChartCraft — Python-powered dashboards that rival Power BI & Tableau.
3
+
4
+ Quick start:
5
+ import chartcraft as cc
6
+
7
+ app = cc.App("My Dashboard", theme="midnight")
8
+
9
+ @app.page("/")
10
+ def home():
11
+ return cc.Dashboard(
12
+ title="Overview",
13
+ kpis=[cc.KPI("Revenue", "$1.2M", change=12.5)],
14
+ charts=[cc.Bar({"Q1": 100, "Q2": 200}, title="Sales", col=0, colspan=12)],
15
+ )
16
+
17
+ app.run() # → http://localhost:8050
18
+ """
19
+
20
+ from chartcraft.server.app_server import AppServer
21
+ from chartcraft.core.models import (
22
+ Dashboard,
23
+ Filter,
24
+ KPI,
25
+ Bar,
26
+ Line,
27
+ Area,
28
+ Pie,
29
+ Donut,
30
+ Scatter,
31
+ Bubble,
32
+ Heatmap,
33
+ Radar,
34
+ Waterfall,
35
+ Funnel,
36
+ Treemap,
37
+ Sankey,
38
+ Gauge,
39
+ Candlestick,
40
+ Histogram,
41
+ BoxPlot,
42
+ Table,
43
+ Metric,
44
+ Divider,
45
+ Spacer,
46
+ TextBlock,
47
+ SectionHeader,
48
+ )
49
+ from chartcraft.core.theme import (
50
+ Theme,
51
+ THEMES,
52
+ get_theme,
53
+ register_theme,
54
+ list_themes,
55
+ )
56
+ from chartcraft.core.colors import (
57
+ PALETTES,
58
+ get_palette,
59
+ list_palettes,
60
+ auto_colors,
61
+ ColorScale,
62
+ lighten,
63
+ darken,
64
+ opacity,
65
+ complementary,
66
+ triadic,
67
+ analogous,
68
+ split_complementary,
69
+ )
70
+ from chartcraft.connectors import connect_sql, connect_csv, connect_api
71
+ from chartcraft.presets import (
72
+ Page,
73
+ executive_page,
74
+ sales_page,
75
+ customer_page,
76
+ product_page,
77
+ section,
78
+ note,
79
+ stat,
80
+ trend_line,
81
+ trend_area,
82
+ comparison_bars,
83
+ ranked_bars,
84
+ spotlight_donut,
85
+ insight_scatter,
86
+ data_table,
87
+ sql_kpi,
88
+ sql_line,
89
+ sql_area,
90
+ sql_bar,
91
+ sql_donut,
92
+ sql_scatter,
93
+ sql_table,
94
+ )
95
+
96
+
97
+ def App(title: str, theme: str = "default") -> AppServer:
98
+ """Create a ChartCraft application."""
99
+ return AppServer(title=title, theme=theme)
100
+
101
+
102
+ def quick_dashboard(
103
+ title: str,
104
+ charts: list,
105
+ theme: str = "default",
106
+ kpis: list = None,
107
+ save_path: str = None,
108
+ ) -> str:
109
+ """
110
+ Quickly create and optionally export a dashboard without defining an App.
111
+
112
+ Returns HTML string (or writes to save_path if provided).
113
+ """
114
+ app = AppServer(title=title, theme=theme)
115
+ dashboard = Dashboard(title=title, kpis=kpis or [], charts=charts)
116
+
117
+ @app.page("/")
118
+ def _page():
119
+ return dashboard
120
+
121
+ html = app.to_html()
122
+ if save_path:
123
+ with open(save_path, "w", encoding="utf-8") as f:
124
+ f.write(html)
125
+ print(f"◆ Exported → {save_path}")
126
+ return html
127
+
128
+
129
+ __version__ = "0.1.0"
130
+ __all__ = [
131
+ "App",
132
+ "AppServer",
133
+ "quick_dashboard",
134
+ "Dashboard",
135
+ "Filter",
136
+ "KPI",
137
+ "Bar",
138
+ "Line",
139
+ "Area",
140
+ "Pie",
141
+ "Donut",
142
+ "Scatter",
143
+ "Bubble",
144
+ "Heatmap",
145
+ "Radar",
146
+ "Waterfall",
147
+ "Funnel",
148
+ "Treemap",
149
+ "Sankey",
150
+ "Gauge",
151
+ "Candlestick",
152
+ "Histogram",
153
+ "BoxPlot",
154
+ "Table",
155
+ "Metric",
156
+ "Divider",
157
+ "Spacer",
158
+ "TextBlock",
159
+ "SectionHeader",
160
+ "Theme",
161
+ "THEMES",
162
+ "get_theme",
163
+ "register_theme",
164
+ "list_themes",
165
+ "PALETTES",
166
+ "get_palette",
167
+ "list_palettes",
168
+ "auto_colors",
169
+ "ColorScale",
170
+ "lighten",
171
+ "darken",
172
+ "opacity",
173
+ "complementary",
174
+ "triadic",
175
+ "analogous",
176
+ "split_complementary",
177
+ "connect_sql",
178
+ "connect_csv",
179
+ "connect_api",
180
+ "Page",
181
+ "executive_page",
182
+ "sales_page",
183
+ "customer_page",
184
+ "product_page",
185
+ "section",
186
+ "note",
187
+ "stat",
188
+ "trend_line",
189
+ "trend_area",
190
+ "comparison_bars",
191
+ "ranked_bars",
192
+ "spotlight_donut",
193
+ "insight_scatter",
194
+ "data_table",
195
+ "sql_kpi",
196
+ "sql_line",
197
+ "sql_area",
198
+ "sql_bar",
199
+ "sql_donut",
200
+ "sql_scatter",
201
+ "sql_table",
202
+ ]
File without changes