chartcraft 0.1.0__tar.gz

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.
Files changed (46) hide show
  1. chartcraft-0.1.0/LICENSE +21 -0
  2. chartcraft-0.1.0/MANIFEST.in +6 -0
  3. chartcraft-0.1.0/PKG-INFO +374 -0
  4. chartcraft-0.1.0/README.md +324 -0
  5. chartcraft-0.1.0/chartcraft/__init__.py +202 -0
  6. chartcraft-0.1.0/chartcraft/builder/__init__.py +0 -0
  7. chartcraft-0.1.0/chartcraft/builder/builder.html +2367 -0
  8. chartcraft-0.1.0/chartcraft/builder/components/color_picker.js +1073 -0
  9. chartcraft-0.1.0/chartcraft/connectors/__init__.py +18 -0
  10. chartcraft-0.1.0/chartcraft/connectors/api.py +60 -0
  11. chartcraft-0.1.0/chartcraft/connectors/csv_connector.py +76 -0
  12. chartcraft-0.1.0/chartcraft/connectors/sql.py +117 -0
  13. chartcraft-0.1.0/chartcraft/core/__init__.py +15 -0
  14. chartcraft-0.1.0/chartcraft/core/colors.py +200 -0
  15. chartcraft-0.1.0/chartcraft/core/models.py +775 -0
  16. chartcraft-0.1.0/chartcraft/core/serializer.py +44 -0
  17. chartcraft-0.1.0/chartcraft/core/theme.py +232 -0
  18. chartcraft-0.1.0/chartcraft/presets.py +456 -0
  19. chartcraft-0.1.0/chartcraft/server/__init__.py +1 -0
  20. chartcraft-0.1.0/chartcraft/server/app_server.py +146 -0
  21. chartcraft-0.1.0/chartcraft/server/codegen.py +386 -0
  22. chartcraft-0.1.0/chartcraft/server/handler.py +865 -0
  23. chartcraft-0.1.0/chartcraft/server/parser.py +439 -0
  24. chartcraft-0.1.0/chartcraft/server/projects.py +76 -0
  25. chartcraft-0.1.0/chartcraft/server/query_api.py +121 -0
  26. chartcraft-0.1.0/chartcraft/server/sse.py +108 -0
  27. chartcraft-0.1.0/chartcraft/static/viewer.html +1593 -0
  28. chartcraft-0.1.0/chartcraft.egg-info/PKG-INFO +374 -0
  29. chartcraft-0.1.0/chartcraft.egg-info/SOURCES.txt +44 -0
  30. chartcraft-0.1.0/chartcraft.egg-info/dependency_links.txt +1 -0
  31. chartcraft-0.1.0/chartcraft.egg-info/requires.txt +28 -0
  32. chartcraft-0.1.0/chartcraft.egg-info/top_level.txt +1 -0
  33. chartcraft-0.1.0/docs/api-reference.md +658 -0
  34. chartcraft-0.1.0/docs/authentication.md +146 -0
  35. chartcraft-0.1.0/docs/builder.md +284 -0
  36. chartcraft-0.1.0/docs/charts.md +580 -0
  37. chartcraft-0.1.0/docs/data-sources.md +361 -0
  38. chartcraft-0.1.0/docs/export-and-deployment.md +335 -0
  39. chartcraft-0.1.0/docs/filters-and-interactivity.md +278 -0
  40. chartcraft-0.1.0/docs/getting-started.md +237 -0
  41. chartcraft-0.1.0/docs/index.md +75 -0
  42. chartcraft-0.1.0/docs/presets-and-page-builders.md +259 -0
  43. chartcraft-0.1.0/docs/realtime.md +203 -0
  44. chartcraft-0.1.0/docs/themes-and-colors.md +293 -0
  45. chartcraft-0.1.0/pyproject.toml +69 -0
  46. chartcraft-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 stephenbaraik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include chartcraft/static *.html
4
+ recursive-include chartcraft/builder *.html *.js
5
+
6
+ recursive-include docs *.md
@@ -0,0 +1,374 @@
1
+ Metadata-Version: 2.4
2
+ Name: chartcraft
3
+ Version: 0.1.0
4
+ Summary: Python-powered dashboards that rival Power BI & Tableau.
5
+ Author-email: stephenbaraik <stephenbaraik@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/stephenbaraik/chartcraft
8
+ Project-URL: Repository, https://github.com/stephenbaraik/chartcraft
9
+ Project-URL: Documentation, https://github.com/stephenbaraik/chartcraft/tree/master/docs
10
+ Project-URL: Bug Tracker, https://github.com/stephenbaraik/chartcraft/issues
11
+ Project-URL: Changelog, https://github.com/stephenbaraik/chartcraft/releases
12
+ Keywords: dashboard,data-visualization,charts,analytics,real-time,echarts,builder,reporting,bi,server-sent-events,streaming
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Visualization
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Provides-Extra: sql
29
+ Requires-Dist: sqlalchemy>=2.0; extra == "sql"
30
+ Provides-Extra: pg
31
+ Requires-Dist: sqlalchemy>=2.0; extra == "pg"
32
+ Requires-Dist: psycopg2-binary; extra == "pg"
33
+ Provides-Extra: mysql
34
+ Requires-Dist: sqlalchemy>=2.0; extra == "mysql"
35
+ Requires-Dist: pymysql; extra == "mysql"
36
+ Provides-Extra: mssql
37
+ Requires-Dist: sqlalchemy>=2.0; extra == "mssql"
38
+ Requires-Dist: pyodbc; extra == "mssql"
39
+ Provides-Extra: pandas
40
+ Requires-Dist: pandas>=1.5; extra == "pandas"
41
+ Provides-Extra: pdf
42
+ Requires-Dist: playwright>=1.40; extra == "pdf"
43
+ Provides-Extra: full
44
+ Requires-Dist: sqlalchemy>=2.0; extra == "full"
45
+ Requires-Dist: psycopg2-binary; extra == "full"
46
+ Requires-Dist: pymysql; extra == "full"
47
+ Requires-Dist: pandas>=1.5; extra == "full"
48
+ Requires-Dist: playwright>=1.40; extra == "full"
49
+ Dynamic: license-file
50
+
51
+ <div align="center">
52
+
53
+ ```
54
+ ██████╗██╗ ██╗ █████╗ ██████╗ ████████╗ ╔══════════════════════════════╗
55
+ ██╔════╝██║ ██║██╔══██╗██╔══██╗╚══██╔══╝ ║ C R A F T C R A F T ║
56
+ ██║ ███████║███████║██████╔╝ ██║ ║ ─────────────────────── ║
57
+ ██║ ██╔══██║██╔══██║██╔══██╗ ██║ ║ Python Dashboard Builder ║
58
+ ╚██████╗██║ ██║██║ ██║██║ ██║ ██║ ╚══════════════════════════════╝
59
+ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
60
+ ```
61
+
62
+ ### Python-powered dashboards that rival Power BI & Tableau.
63
+
64
+ *Write Python. Get a stunning, interactive, real-time dashboard — instantly.*
65
+
66
+ <br/>
67
+
68
+ [![Python](https://img.shields.io/badge/Python-3.11%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org)
69
+ [![ECharts](https://img.shields.io/badge/ECharts-5.5-E14329?style=for-the-badge&logo=apache&logoColor=white)](https://echarts.apache.org)
70
+ [![License](https://img.shields.io/badge/License-MIT-10B981?style=for-the-badge)](LICENSE)
71
+ [![Deps](https://img.shields.io/badge/Dependencies-Zero-8B5CF6?style=for-the-badge)](#)
72
+ [![SSE](https://img.shields.io/badge/Server-SSE%20Streaming-EC4899?style=for-the-badge)](#)
73
+
74
+ <br/>
75
+
76
+ [**Quickstart**](#-quickstart) · [**Docs**](docs/getting-started.md) · [**Presets & Builders**](docs/presets-and-page-builders.md) · [**Data Sources**](docs/data-sources.md) · [**API Reference**](docs/api-reference.md)
77
+
78
+ <br/>
79
+
80
+ </div>
81
+
82
+ ---
83
+
84
+ ## ◆ Three API Layers
85
+
86
+ Choose the level that matches how fast you want to move:
87
+
88
+ | Layer | What it is | Use when |
89
+ |-------|-----------|----------|
90
+ | **Core classes** | `cc.Dashboard`, `cc.Bar`, `cc.Line`, `cc.KPI`, `cc.Filter` | You need exact control |
91
+ | **Presets & helpers** | `cc.Page(...)`, `cc.section(...)`, `cc.trend_line(...)`, `cc.sql_kpi(...)` | You want clean, readable code |
92
+ | **Page builders** | `cc.executive_page(...)`, `cc.sales_page(...)`, `cc.customer_page(...)`, `cc.product_page(...)` | Your dashboard fits a common story |
93
+
94
+ The **Dashboard Builder** at `http://localhost:8050/builder` is a full drag-and-drop canvas that generates live Python code as you design — and stays in sync both ways. No build step. No npm. No JavaScript.
95
+
96
+ ---
97
+
98
+ ## ◆ Quickstart
99
+
100
+ ```bash
101
+ pip install chartcraft
102
+ ```
103
+
104
+ ```python
105
+ import chartcraft as cc
106
+
107
+ app = cc.App("Revenue Review", theme="midnight")
108
+
109
+ @app.page("/")
110
+ def overview():
111
+ monthly = [
112
+ {"month": "Jan", "revenue": 120, "profit": 28},
113
+ {"month": "Feb", "revenue": 138, "profit": 31},
114
+ {"month": "Mar", "revenue": 149, "profit": 36},
115
+ ]
116
+
117
+ return cc.Page(
118
+ title="Revenue Review",
119
+ subtitle="Q1 snapshot",
120
+ kpis=[
121
+ cc.stat("Revenue", "$407K", change=11.4),
122
+ cc.stat("Profit Margin", "24%", change=1.8),
123
+ ],
124
+ content=[
125
+ cc.section(
126
+ "Momentum",
127
+ cc.trend_line(
128
+ monthly,
129
+ x="month",
130
+ y=["revenue", "profit"],
131
+ title="Revenue vs Profit",
132
+ col=0, colspan=8, height=320,
133
+ ),
134
+ cc.spotlight_donut(
135
+ {"Direct": 52, "Partner": 31, "Online": 17},
136
+ title="Channel Mix",
137
+ col=8, colspan=4,
138
+ center_text="Q1",
139
+ ),
140
+ subtitle="Tracking ahead of plan",
141
+ ),
142
+ cc.note("Revenue stays ahead of plan while profit improves each month."),
143
+ cc.section(
144
+ "Leaders",
145
+ cc.ranked_bars(
146
+ [
147
+ {"rep": "Avery", "revenue": 92},
148
+ {"rep": "Noah", "revenue": 84},
149
+ {"rep": "Mia", "revenue": 79},
150
+ ],
151
+ x="rep", y="revenue",
152
+ title="Top Reps",
153
+ col=0, colspan=6,
154
+ ),
155
+ cc.data_table(
156
+ [
157
+ {"region": "West", "revenue": 168, "profit": 43},
158
+ {"region": "East", "revenue": 137, "profit": 31},
159
+ {"region": "Central", "revenue": 102, "profit": 24},
160
+ ],
161
+ title="Regional Detail",
162
+ columns=["region", "revenue", "profit"],
163
+ col=6, colspan=6, page_size=5,
164
+ ),
165
+ ),
166
+ ],
167
+ )
168
+
169
+ app.run()
170
+ # ◆ ChartCraft → http://localhost:8050
171
+ # Builder → http://localhost:8050/builder
172
+ ```
173
+
174
+ ---
175
+
176
+ ## ◆ Layout Helpers
177
+
178
+ ```python
179
+ cc.Page(title, subtitle="", kpis=[], filters=[], content=[], charts=[], cols=12, ...)
180
+ cc.section(title, *content, subtitle="", col=0, colspan=12)
181
+ cc.note(content, col=0, colspan=12)
182
+ cc.stat(title, value=None, **kwargs) # thin shortcut for cc.KPI(...)
183
+ ```
184
+
185
+ ---
186
+
187
+ ## ◆ Chart Presets
188
+
189
+ Return standard chart classes with tuned defaults:
190
+
191
+ ```
192
+ cc.trend_line smooth curve, no dots — great for time series
193
+ cc.trend_area filled area chart — shows volume over time
194
+ cc.comparison_bars grouped bars — compare target vs actual
195
+ cc.ranked_bars horizontal, show values — top-N rankings
196
+ cc.spotlight_donut donut with center label — mix / composition
197
+ cc.insight_scatter sized scatter — correlation analysis
198
+ cc.data_table sortable + searchable — tabular detail
199
+ ```
200
+
201
+ ---
202
+
203
+ ## ◆ SQL Helpers
204
+
205
+ Wire a connector to charts so queries re-run on every refresh or filter change:
206
+
207
+ ```python
208
+ db = cc.connect_sql("sqlite:///sales.db")
209
+
210
+ cc.Page(
211
+ title="SQL Example",
212
+ filters=[cc.Filter("year", options=["All", "2024", "2025"])],
213
+ kpis=[
214
+ cc.sql_kpi(
215
+ "Revenue", db,
216
+ lambda f: (
217
+ "SELECT SUM(revenue) FROM monthly_sales"
218
+ if f.get("year") in (None, "All")
219
+ else f"SELECT SUM(revenue) FROM monthly_sales WHERE year = {f['year']}"
220
+ ),
221
+ field="revenue",
222
+ formatter=lambda v, _f: f"${v:,.0f}",
223
+ linked_filters=["year"],
224
+ )
225
+ ],
226
+ content=[
227
+ cc.section(
228
+ "Trend",
229
+ cc.sql_line(
230
+ db,
231
+ "SELECT month, revenue, profit FROM monthly_sales ORDER BY month",
232
+ x="month", y=["revenue", "profit"],
233
+ title="Monthly Performance",
234
+ col=0, colspan=8,
235
+ ),
236
+ cc.sql_table(
237
+ db,
238
+ "SELECT month, revenue, profit FROM monthly_sales ORDER BY month",
239
+ title="Rows",
240
+ columns=["month", "revenue", "profit"],
241
+ col=8, colspan=4,
242
+ ),
243
+ )
244
+ ],
245
+ )
246
+ ```
247
+
248
+ All helpers: `sql_kpi` · `sql_line` · `sql_area` · `sql_bar` · `sql_donut` · `sql_scatter` · `sql_table`
249
+
250
+ Core classes also support `.from_sql(...)` at runtime:
251
+ ```python
252
+ cc.Bar.from_sql(db, "SELECT region, revenue FROM sales ORDER BY revenue DESC", x="region", y="revenue")
253
+ ```
254
+
255
+ ---
256
+
257
+ ## ◆ Page Builders
258
+
259
+ Drop in a complete sectioned dashboard when your story fits a common narrative:
260
+
261
+ ```python
262
+ cc.executive_page(title, kpis=[...], hero=[...], performance=[...], note_text="...")
263
+ cc.sales_page(title, kpis=[...], trend=[...], analysis=[...], ranking=[...])
264
+ cc.customer_page(title, kpis=[...], mix=[...], geography=[...], accounts=[...])
265
+ cc.product_page(title, kpis=[...], overview=[...], profitability=[...], leaders=[...])
266
+ ```
267
+
268
+ ---
269
+
270
+ ## ◆ Real-Time Streaming
271
+
272
+ Server-Sent Events push full chart specs to every browser — no WebSocket, no polling, no frontend code:
273
+
274
+ ```python
275
+ cc.Line(
276
+ data_fn=lambda: db.query_dict("SELECT ts, value FROM metrics ORDER BY ts DESC LIMIT 100"),
277
+ x="ts", y="value",
278
+ title="Live Stream",
279
+ refresh=3, # push new data every 3 seconds
280
+ smooth=True,
281
+ )
282
+ ```
283
+
284
+ Each component refreshes on its own interval independently.
285
+
286
+ ---
287
+
288
+ ## ◆ Connect to Anything
289
+
290
+ ```python
291
+ db = cc.connect_sql("sqlite:///analytics.db") # zero deps
292
+ db = cc.connect_sql("postgresql://user:pass@host:5432/db") # pip install "chartcraft[pg]"
293
+ csv = cc.connect_csv("sales.csv")
294
+ csv = cc.connect_csv("./data/") # load entire directory
295
+ api = cc.connect_api("https://api.example.com", headers={"Authorization": "Bearer ..."})
296
+ ```
297
+
298
+ ---
299
+
300
+ ## ◆ Themes
301
+
302
+ 11 built-in themes, switch live in the browser:
303
+
304
+ ```
305
+ dark themes ──────────────────────────────────────────────────────────────
306
+ midnight ████ deep purple bg · purple accent
307
+ obsidian ████ pitch black · cyan accent
308
+ default ████ dark zinc · indigo accent
309
+ ember ████ warm dark · orange accent
310
+ jade ████ forest dark · green accent
311
+ candy ████ pink dark · magenta accent
312
+ arctic ████ ice dark · sky blue accent
313
+ retro ████ vintage teal · gold accent
314
+ light themes ─────────────────────────────────────────────────────────────
315
+ frost ░░░░ clean light · blue accent
316
+ slate ░░░░ professional · navy accent
317
+ scientific ░░░░ academic · slate accent
318
+ ```
319
+
320
+ ---
321
+
322
+ ## ◆ How It Compares
323
+
324
+ | | ChartCraft | Power BI | Tableau | Plotly Dash | Streamlit |
325
+ |--|:-:|:-:|:-:|:-:|:-:|
326
+ | Pure Python API | ✅ | ❌ | ❌ | ✅ | ✅ |
327
+ | Drag-and-drop visual builder | ✅ | ✅ | ✅ | ❌ | ❌ |
328
+ | Bidirectional code ↔ canvas | ✅ | ❌ | ❌ | ❌ | ❌ |
329
+ | Zero required dependencies | ✅ | ❌ | ❌ | ❌ | ❌ |
330
+ | Real-time SSE push | ✅ | ❌ | ❌ | ✅ | ✅ |
331
+ | Export to standalone HTML | ✅ | limited | limited | ❌ | ❌ |
332
+ | No build step / no npm | ✅ | ✅ | ✅ | ❌ | ✅ |
333
+ | PDF / Jupyter / Docker export | ✅ | partial | partial | ❌ | ❌ |
334
+
335
+ ---
336
+
337
+ ## ◆ Tech Stack
338
+
339
+ ```
340
+ Python 3.11+ ── stdlib only · threading · sqlite3
341
+ ECharts 5.5 ── GPU canvas · 18+ chart types · CDN only
342
+ Preact 10 ── 3KB React-compatible · no build step
343
+ SSE ── text/event-stream · auto-reconnect
344
+ ```
345
+
346
+ ---
347
+
348
+ ## ◆ Documentation
349
+
350
+ | | Guide |
351
+ |--|-------|
352
+ | [🚀 Getting Started](docs/getting-started.md) | Install, first dashboard, core concepts |
353
+ | [📊 Presets & Page Builders](docs/presets-and-page-builders.md) | Layout helpers, chart presets, SQL helpers, page builders |
354
+ | [🗃 Data Sources](docs/data-sources.md) | SQL, CSV, REST connectors, filter-linked queries |
355
+ | [📈 Chart Types](docs/charts.md) | All 18+ chart types, options, data formats |
356
+ | [🎨 Themes & Colors](docs/themes-and-colors.md) | Themes, palettes, custom branding, color utilities |
357
+ | [🎛 Filters & Interactivity](docs/filters-and-interactivity.md) | Filter types, cross-filtering, URL state |
358
+ | [⚡ Real-Time Data](docs/realtime.md) | SSE internals, refresh intervals, LIVE badge |
359
+ | [🖱 Visual Builder](docs/builder.md) | Canvas, color picker, code sync, shortcuts |
360
+ | [📦 Export & Deployment](docs/export-and-deployment.md) | HTML, PDF, Jupyter, Docker, nginx |
361
+ | [🔒 Authentication](docs/authentication.md) | Basic auth, bearer tokens, env vars |
362
+ | [📖 API Reference](docs/api-reference.md) | Every class, method, parameter, HTTP endpoint |
363
+
364
+ ---
365
+
366
+ <div align="center">
367
+
368
+ ```
369
+ pip install chartcraft
370
+ ```
371
+
372
+ **MIT License** · Built with Python · Powered by ECharts
373
+
374
+ </div>