datasight 0.0.1__tar.gz → 0.3.1__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.
- datasight-0.3.1/.github/dependabot.yml +34 -0
- datasight-0.3.1/.github/workflows/ci.yml +141 -0
- datasight-0.3.1/.github/workflows/codeql.yml +42 -0
- datasight-0.3.1/.github/workflows/gh-pages.yml +33 -0
- datasight-0.3.1/.github/workflows/release.yml +45 -0
- datasight-0.3.1/.gitignore +16 -0
- datasight-0.3.1/.pre-commit-config.yaml +22 -0
- datasight-0.3.1/AGENTS.md +142 -0
- datasight-0.3.1/CLAUDE.md +148 -0
- datasight-0.3.1/DISCLAIMER.md +5 -0
- datasight-0.3.1/LICENSE +29 -0
- datasight-0.3.1/PKG-INFO +164 -0
- datasight-0.3.1/README.md +122 -0
- datasight-0.3.1/codecov.yml +16 -0
- datasight-0.3.1/dashboard-filter-roadmap.md +178 -0
- datasight-0.3.1/docs/assets/datasight-icon.svg +9 -0
- datasight-0.3.1/docs/assets/screenshots/01-landing.png +0 -0
- datasight-0.3.1/docs/assets/screenshots/02-chat-view.png +0 -0
- datasight-0.3.1/docs/assets/screenshots/03-sql-editor.png +0 -0
- datasight-0.3.1/docs/assets/screenshots/04-chart-result.png +0 -0
- datasight-0.3.1/docs/assets/screenshots/05-dashboard.png +0 -0
- datasight-0.3.1/docs/assets/screenshots/06-web-ui-reference.png +0 -0
- datasight-0.3.1/docs/concepts/choosing-an-llm.md +175 -0
- datasight-0.3.1/docs/concepts/how-the-agent-works.md +119 -0
- datasight-0.3.1/docs/concepts/sql-result-cache.md +110 -0
- datasight-0.3.1/docs/concepts/users-and-roles.md +70 -0
- datasight-0.3.1/docs/end-user/explanation/query-confidence.md +65 -0
- datasight-0.3.1/docs/end-user/explanation/semantic-measures.md +78 -0
- datasight-0.3.1/docs/end-user/explanation/trusting-ai-results.md +45 -0
- datasight-0.3.1/docs/end-user/how-to/ask-from-cli.md +233 -0
- datasight-0.3.1/docs/end-user/how-to/ask-in-web-ui.md +128 -0
- datasight-0.3.1/docs/end-user/how-to/audit-data-quality.md +334 -0
- datasight-0.3.1/docs/end-user/how-to/build-a-dashboard.md +102 -0
- datasight-0.3.1/docs/end-user/how-to/configure-measures.md +166 -0
- datasight-0.3.1/docs/end-user/how-to/connect-flight-sql.md +385 -0
- datasight-0.3.1/docs/end-user/how-to/create-visualizations.md +117 -0
- datasight-0.3.1/docs/end-user/how-to/declare-time-series.md +176 -0
- datasight-0.3.1/docs/end-user/how-to/explore-files.md +130 -0
- datasight-0.3.1/docs/end-user/how-to/install.md +84 -0
- datasight-0.3.1/docs/end-user/how-to/review-query-log.md +107 -0
- datasight-0.3.1/docs/end-user/how-to/run-on-hpc.md +132 -0
- datasight-0.3.1/docs/end-user/how-to/save-and-rerun.md +90 -0
- datasight-0.3.1/docs/end-user/how-to/save-dashboard-template.md +223 -0
- datasight-0.3.1/docs/end-user/reference/keyboard-shortcuts.md +40 -0
- datasight-0.3.1/docs/end-user/reference/query-confidence-toggles.md +28 -0
- datasight-0.3.1/docs/end-user/reference/web-ui.md +194 -0
- datasight-0.3.1/docs/end-user/tutorials/getting-started.md +86 -0
- datasight-0.3.1/docs/end-user/tutorials/tempo.md +103 -0
- datasight-0.3.1/docs/end-user/tutorials/time-validation.md +71 -0
- datasight-0.3.1/docs/index.md +70 -0
- datasight-0.3.1/docs/project-developer/database-connections.md +186 -0
- datasight-0.3.1/docs/project-developer/example-queries.md +92 -0
- datasight-0.3.1/docs/project-developer/querying-files.md +184 -0
- datasight-0.3.1/docs/project-developer/schema-config.md +253 -0
- datasight-0.3.1/docs/project-developer/schema-description.md +63 -0
- datasight-0.3.1/docs/project-developer/set-up-project.md +285 -0
- datasight-0.3.1/docs/project-developer/verification.md +128 -0
- datasight-0.3.1/docs/reference/cli.md +1075 -0
- datasight-0.3.1/docs/reference/configuration.md +160 -0
- datasight-0.3.1/docs/stylesheets/extra.css +230 -0
- datasight-0.3.1/docs/tool-developer/architecture.md +262 -0
- datasight-0.3.1/docs/tool-developer/contributing.md +226 -0
- datasight-0.3.1/frontend/e2e/screenshots.spec.ts +122 -0
- datasight-0.3.1/frontend/e2e/smoke.spec.ts +65 -0
- datasight-0.3.1/frontend/index.html +30 -0
- datasight-0.3.1/frontend/package-lock.json +3340 -0
- datasight-0.3.1/frontend/package.json +36 -0
- datasight-0.3.1/frontend/playwright.config.ts +12 -0
- datasight-0.3.1/frontend/public/datasight-icon.svg +9 -0
- datasight-0.3.1/frontend/src/App.svelte +440 -0
- datasight-0.3.1/frontend/src/app.css +420 -0
- datasight-0.3.1/frontend/src/assets/datasight-icon.svg +9 -0
- datasight-0.3.1/frontend/src/lib/api/chat.ts +434 -0
- datasight-0.3.1/frontend/src/lib/api/client.ts +54 -0
- datasight-0.3.1/frontend/src/lib/api/dashboard.ts +126 -0
- datasight-0.3.1/frontend/src/lib/api/measures.ts +71 -0
- datasight-0.3.1/frontend/src/lib/api/projects.ts +167 -0
- datasight-0.3.1/frontend/src/lib/api/saved.ts +127 -0
- datasight-0.3.1/frontend/src/lib/api/schema.ts +66 -0
- datasight-0.3.1/frontend/src/lib/api/settings.ts +55 -0
- datasight-0.3.1/frontend/src/lib/api/sql.ts +36 -0
- datasight-0.3.1/frontend/src/lib/api/starters.ts +56 -0
- datasight-0.3.1/frontend/src/lib/api/summarize.ts +113 -0
- datasight-0.3.1/frontend/src/lib/components/AddFilesInput.svelte +61 -0
- datasight-0.3.1/frontend/src/lib/components/BookmarksList.svelte +50 -0
- datasight-0.3.1/frontend/src/lib/components/ChartResult.svelte +80 -0
- datasight-0.3.1/frontend/src/lib/components/ChatInput.svelte +136 -0
- datasight-0.3.1/frontend/src/lib/components/ChatView.svelte +10 -0
- datasight-0.3.1/frontend/src/lib/components/ClarifyOptions.svelte +28 -0
- datasight-0.3.1/frontend/src/lib/components/CodeEditor.svelte +295 -0
- datasight-0.3.1/frontend/src/lib/components/CommandPalette.svelte +413 -0
- datasight-0.3.1/frontend/src/lib/components/ConversationsList.svelte +70 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardCard.svelte +286 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardGrid.svelte +74 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardNote.svelte +110 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardSection.svelte +123 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardToolbar.svelte +864 -0
- datasight-0.3.1/frontend/src/lib/components/DashboardView.svelte +12 -0
- datasight-0.3.1/frontend/src/lib/components/DiscoveredFilesCard.svelte +140 -0
- datasight-0.3.1/frontend/src/lib/components/ExploreCard.svelte +88 -0
- datasight-0.3.1/frontend/src/lib/components/ExportBar.svelte +86 -0
- datasight-0.3.1/frontend/src/lib/components/Header.svelte +291 -0
- datasight-0.3.1/frontend/src/lib/components/LandingPage.svelte +89 -0
- datasight-0.3.1/frontend/src/lib/components/LlmConfigForm.svelte +152 -0
- datasight-0.3.1/frontend/src/lib/components/MeasureEditor.svelte +82 -0
- datasight-0.3.1/frontend/src/lib/components/MeasureEditorModal.svelte +690 -0
- datasight-0.3.1/frontend/src/lib/components/MessageBubble.svelte +175 -0
- datasight-0.3.1/frontend/src/lib/components/MessageList.svelte +291 -0
- datasight-0.3.1/frontend/src/lib/components/PlotlyChart.svelte +226 -0
- datasight-0.3.1/frontend/src/lib/components/ProjectCard.svelte +124 -0
- datasight-0.3.1/frontend/src/lib/components/ProjectHealth.svelte +160 -0
- datasight-0.3.1/frontend/src/lib/components/ProjectsPanel.svelte +295 -0
- datasight-0.3.1/frontend/src/lib/components/QueriesList.svelte +37 -0
- datasight-0.3.1/frontend/src/lib/components/QueryHistoryPanel.svelte +273 -0
- datasight-0.3.1/frontend/src/lib/components/RecipesList.svelte +26 -0
- datasight-0.3.1/frontend/src/lib/components/ReportsList.svelte +177 -0
- datasight-0.3.1/frontend/src/lib/components/RunDetails.svelte +206 -0
- datasight-0.3.1/frontend/src/lib/components/SaveProjectModal.svelte +248 -0
- datasight-0.3.1/frontend/src/lib/components/SchemaInspector.svelte +300 -0
- datasight-0.3.1/frontend/src/lib/components/SettingsPanel.svelte +234 -0
- datasight-0.3.1/frontend/src/lib/components/ShortcutsModal.svelte +75 -0
- datasight-0.3.1/frontend/src/lib/components/Sidebar.svelte +168 -0
- datasight-0.3.1/frontend/src/lib/components/SidebarSection.svelte +77 -0
- datasight-0.3.1/frontend/src/lib/components/SqlConfirmDialog.svelte +88 -0
- datasight-0.3.1/frontend/src/lib/components/SqlView.svelte +215 -0
- datasight-0.3.1/frontend/src/lib/components/StarterGrid.svelte +134 -0
- datasight-0.3.1/frontend/src/lib/components/StarterOverview.svelte +471 -0
- datasight-0.3.1/frontend/src/lib/components/SuggestionButtons.svelte +27 -0
- datasight-0.3.1/frontend/src/lib/components/TableResult.svelte +297 -0
- datasight-0.3.1/frontend/src/lib/components/Toast.svelte +23 -0
- datasight-0.3.1/frontend/src/lib/components/ToolIndicator.svelte +45 -0
- datasight-0.3.1/frontend/src/lib/stores/chat.svelte.ts +170 -0
- datasight-0.3.1/frontend/src/lib/stores/dashboard.svelte.ts +215 -0
- datasight-0.3.1/frontend/src/lib/stores/palette.svelte.ts +76 -0
- datasight-0.3.1/frontend/src/lib/stores/queries.svelte.ts +55 -0
- datasight-0.3.1/frontend/src/lib/stores/schema.svelte.ts +108 -0
- datasight-0.3.1/frontend/src/lib/stores/session.svelte.ts +89 -0
- datasight-0.3.1/frontend/src/lib/stores/settings.svelte.ts +83 -0
- datasight-0.3.1/frontend/src/lib/stores/sidebar.svelte.ts +111 -0
- datasight-0.3.1/frontend/src/lib/stores/sql_editor.svelte.ts +86 -0
- datasight-0.3.1/frontend/src/lib/stores/toast.svelte.ts +29 -0
- datasight-0.3.1/frontend/src/lib/types/plotly-js-dist-min.d.ts +19 -0
- datasight-0.3.1/frontend/src/lib/types/plotly.ts +4 -0
- datasight-0.3.1/frontend/src/lib/utils/conversation.ts +202 -0
- datasight-0.3.1/frontend/src/lib/utils/emacs-keys.ts +122 -0
- datasight-0.3.1/frontend/src/lib/utils/format.ts +24 -0
- datasight-0.3.1/frontend/src/lib/utils/markdown.ts +55 -0
- datasight-0.3.1/frontend/src/lib/utils/search.ts +111 -0
- datasight-0.3.1/frontend/src/lib/utils/sql-completion.ts +198 -0
- datasight-0.3.1/frontend/src/main.ts +9 -0
- datasight-0.3.1/frontend/svelte.config.js +5 -0
- datasight-0.3.1/frontend/tests/chat.test.ts +107 -0
- datasight-0.3.1/frontend/tests/emacs-keys.test.ts +125 -0
- datasight-0.3.1/frontend/tests/format.test.ts +50 -0
- datasight-0.3.1/frontend/tests/search.test.ts +137 -0
- datasight-0.3.1/frontend/tests/sql-completion.test.ts +89 -0
- datasight-0.3.1/frontend/tests/stores.test.ts +526 -0
- datasight-0.3.1/frontend/tests/summarize.test.ts +70 -0
- datasight-0.3.1/frontend/tsconfig.json +19 -0
- datasight-0.3.1/frontend/vite.config.ts +23 -0
- datasight-0.3.1/frontend/vitest.config.ts +16 -0
- datasight-0.3.1/mkdocs.yml +114 -0
- datasight-0.3.1/pyproject.toml +104 -0
- datasight-0.3.1/scripts/build-frontend.sh +31 -0
- datasight-0.3.1/scripts/generate_cli_reference.py +183 -0
- datasight-0.3.1/src/datasight/__init__.py +14 -0
- datasight-0.3.1/src/datasight/__main__.py +5 -0
- datasight-0.3.1/src/datasight/agent.py +978 -0
- datasight-0.3.1/src/datasight/audit_report.py +331 -0
- datasight-0.3.1/src/datasight/chart.py +43 -0
- datasight-0.3.1/src/datasight/cli.py +5904 -0
- datasight-0.3.1/src/datasight/config.py +513 -0
- datasight-0.3.1/src/datasight/cost.py +103 -0
- datasight-0.3.1/src/datasight/dashboard_template.py +577 -0
- datasight-0.3.1/src/datasight/data_profile.py +1654 -0
- datasight-0.3.1/src/datasight/demo.py +339 -0
- datasight-0.3.1/src/datasight/demo_dsgrid_tempo.py +380 -0
- datasight-0.3.1/src/datasight/demo_time_validation.py +555 -0
- datasight-0.3.1/src/datasight/distribution.py +471 -0
- datasight-0.3.1/src/datasight/events.py +26 -0
- datasight-0.3.1/src/datasight/exceptions.py +91 -0
- datasight-0.3.1/src/datasight/explore.py +626 -0
- datasight-0.3.1/src/datasight/export.py +400 -0
- datasight-0.3.1/src/datasight/generate.py +271 -0
- datasight-0.3.1/src/datasight/identifiers.py +117 -0
- datasight-0.3.1/src/datasight/integrity.py +275 -0
- datasight-0.3.1/src/datasight/llm.py +889 -0
- datasight-0.3.1/src/datasight/prompts.py +292 -0
- datasight-0.3.1/src/datasight/query_log.py +105 -0
- datasight-0.3.1/src/datasight/recent_projects.py +100 -0
- datasight-0.3.1/src/datasight/runner.py +548 -0
- datasight-0.3.1/src/datasight/schema.py +389 -0
- datasight-0.3.1/src/datasight/settings.py +414 -0
- datasight-0.3.1/src/datasight/sql_validation.py +241 -0
- datasight-0.3.1/src/datasight/templates/env.template +85 -0
- datasight-0.3.1/src/datasight/templates/global_env.template +23 -0
- datasight-0.3.1/src/datasight/templates/html/audit_report.mustache +185 -0
- datasight-0.3.1/src/datasight/templates/html/chart.mustache +259 -0
- datasight-0.3.1/src/datasight/templates/html/export_dashboard.mustache +261 -0
- datasight-0.3.1/src/datasight/templates/html/export_session.mustache +168 -0
- datasight-0.3.1/src/datasight/templates/queries.yaml +34 -0
- datasight-0.3.1/src/datasight/templates/schema_description.md +19 -0
- datasight-0.3.1/src/datasight/templates/time_series.yaml +19 -0
- datasight-0.3.1/src/datasight/templates/validation.yaml +41 -0
- datasight-0.3.1/src/datasight/templating.py +100 -0
- datasight-0.3.1/src/datasight/validation.py +489 -0
- datasight-0.3.1/src/datasight/verify.py +437 -0
- datasight-0.3.1/src/datasight/web/__init__.py +0 -0
- datasight-0.3.1/src/datasight/web/app.py +3722 -0
- datasight-0.3.1/src/datasight/web/static/assets/index-BLWRdIfD.js +366 -0
- datasight-0.3.1/src/datasight/web/static/assets/index-Cq4zJr8M.css +1 -0
- datasight-0.3.1/src/datasight/web/static/assets/plotly.min-CzY2oMrX.js +3858 -0
- datasight-0.3.1/src/datasight/web/static/datasight-icon.svg +9 -0
- datasight-0.3.1/src/datasight/web/templates/index.html +31 -0
- datasight-0.3.1/tests/__init__.py +0 -0
- datasight-0.3.1/tests/_env_helpers.py +38 -0
- datasight-0.3.1/tests/conftest.py +147 -0
- datasight-0.3.1/tests/test_agent.py +289 -0
- datasight-0.3.1/tests/test_agent_extra.py +349 -0
- datasight-0.3.1/tests/test_audit.py +1200 -0
- datasight-0.3.1/tests/test_audit_report_extra.py +264 -0
- datasight-0.3.1/tests/test_caching_runner.py +134 -0
- datasight-0.3.1/tests/test_cli_ask.py +236 -0
- datasight-0.3.1/tests/test_cli_commands.py +650 -0
- datasight-0.3.1/tests/test_cli_config.py +216 -0
- datasight-0.3.1/tests/test_cli_tools.py +2751 -0
- datasight-0.3.1/tests/test_cli_tools_extra.py +1176 -0
- datasight-0.3.1/tests/test_config.py +131 -0
- datasight-0.3.1/tests/test_config_extra.py +334 -0
- datasight-0.3.1/tests/test_dashboard_template.py +955 -0
- datasight-0.3.1/tests/test_data_profile_extra.py +466 -0
- datasight-0.3.1/tests/test_distribution.py +226 -0
- datasight-0.3.1/tests/test_docs_cli_reference.py +8 -0
- datasight-0.3.1/tests/test_explore.py +490 -0
- datasight-0.3.1/tests/test_explore_extra.py +193 -0
- datasight-0.3.1/tests/test_export.py +279 -0
- datasight-0.3.1/tests/test_export_extra.py +124 -0
- datasight-0.3.1/tests/test_generate.py +336 -0
- datasight-0.3.1/tests/test_generate_extra.py +83 -0
- datasight-0.3.1/tests/test_generate_persist_db.py +340 -0
- datasight-0.3.1/tests/test_identifiers.py +157 -0
- datasight-0.3.1/tests/test_integrity.py +158 -0
- datasight-0.3.1/tests/test_llm.py +808 -0
- datasight-0.3.1/tests/test_prompts.py +41 -0
- datasight-0.3.1/tests/test_query_log.py +136 -0
- datasight-0.3.1/tests/test_recent_projects.py +160 -0
- datasight-0.3.1/tests/test_reports.py +316 -0
- datasight-0.3.1/tests/test_runner.py +83 -0
- datasight-0.3.1/tests/test_runner_extra.py +528 -0
- datasight-0.3.1/tests/test_schema.py +102 -0
- datasight-0.3.1/tests/test_schema_config_load.py +153 -0
- datasight-0.3.1/tests/test_schema_extra.py +199 -0
- datasight-0.3.1/tests/test_schema_filter.py +196 -0
- datasight-0.3.1/tests/test_settings.py +210 -0
- datasight-0.3.1/tests/test_settings_extra.py +163 -0
- datasight-0.3.1/tests/test_sql_validation.py +135 -0
- datasight-0.3.1/tests/test_sql_validation_extra.py +185 -0
- datasight-0.3.1/tests/test_time_series.py +814 -0
- datasight-0.3.1/tests/test_validation.py +374 -0
- datasight-0.3.1/tests/test_verify.py +506 -0
- datasight-0.3.1/tests/test_web_app.py +1713 -0
- datasight-0.3.1/tests/test_web_app_extra.py +955 -0
- datasight-0.3.1/tests/test_web_ui_smoke.py +331 -0
- datasight-0.3.1/uv.lock +1466 -0
- datasight-0.0.1/.gitignore +0 -4
- datasight-0.0.1/PKG-INFO +0 -7
- datasight-0.0.1/datasight/__init__.py +0 -2
- datasight-0.0.1/pyproject.toml +0 -16
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "uv"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
open-pull-requests-limit: 5
|
|
8
|
+
groups:
|
|
9
|
+
python-minor-patch:
|
|
10
|
+
update-types:
|
|
11
|
+
- "minor"
|
|
12
|
+
- "patch"
|
|
13
|
+
|
|
14
|
+
- package-ecosystem: "npm"
|
|
15
|
+
directory: "/frontend"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "weekly"
|
|
18
|
+
open-pull-requests-limit: 5
|
|
19
|
+
groups:
|
|
20
|
+
npm-minor-patch:
|
|
21
|
+
update-types:
|
|
22
|
+
- "minor"
|
|
23
|
+
- "patch"
|
|
24
|
+
|
|
25
|
+
- package-ecosystem: "github-actions"
|
|
26
|
+
directory: "/"
|
|
27
|
+
schedule:
|
|
28
|
+
interval: "weekly"
|
|
29
|
+
open-pull-requests-limit: 5
|
|
30
|
+
groups:
|
|
31
|
+
actions-minor-patch:
|
|
32
|
+
update-types:
|
|
33
|
+
- "minor"
|
|
34
|
+
- "patch"
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v4
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.13"
|
|
19
|
+
# Cache disabled: the post-job prune step hits the GitHub Actions
|
|
20
|
+
# cache service and fails the whole job when that service is
|
|
21
|
+
# unhealthy. Install is fast enough without the cache that
|
|
22
|
+
# reliability wins over the ~30s speedup.
|
|
23
|
+
enable-cache: false
|
|
24
|
+
|
|
25
|
+
- name: Set up Node
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: "22"
|
|
29
|
+
cache: npm
|
|
30
|
+
cache-dependency-path: frontend/package-lock.json
|
|
31
|
+
|
|
32
|
+
- name: Install Python project
|
|
33
|
+
run: uv sync --extra dev --frozen
|
|
34
|
+
|
|
35
|
+
- name: Install frontend dependencies
|
|
36
|
+
run: npm ci
|
|
37
|
+
working-directory: frontend
|
|
38
|
+
|
|
39
|
+
- name: Run Ruff lint
|
|
40
|
+
run: uv run ruff check .
|
|
41
|
+
|
|
42
|
+
- name: Check Ruff formatting
|
|
43
|
+
run: uv run ruff format --check .
|
|
44
|
+
|
|
45
|
+
- name: Run ty
|
|
46
|
+
run: uv run ty check
|
|
47
|
+
|
|
48
|
+
- name: Check frontend types
|
|
49
|
+
run: npm run check
|
|
50
|
+
working-directory: frontend
|
|
51
|
+
|
|
52
|
+
test:
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- name: Install uv
|
|
58
|
+
uses: astral-sh/setup-uv@v4
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.13"
|
|
61
|
+
# Cache disabled: the post-job prune step hits the GitHub Actions
|
|
62
|
+
# cache service and fails the whole job when that service is
|
|
63
|
+
# unhealthy. Install is fast enough without the cache that
|
|
64
|
+
# reliability wins over the ~30s speedup.
|
|
65
|
+
enable-cache: false
|
|
66
|
+
|
|
67
|
+
- name: Set up Node
|
|
68
|
+
uses: actions/setup-node@v4
|
|
69
|
+
with:
|
|
70
|
+
node-version: "22"
|
|
71
|
+
cache: npm
|
|
72
|
+
cache-dependency-path: frontend/package-lock.json
|
|
73
|
+
|
|
74
|
+
- name: Install Python project
|
|
75
|
+
run: |
|
|
76
|
+
mkdir -p src/datasight/web/static/assets
|
|
77
|
+
uv sync --extra dev --frozen
|
|
78
|
+
|
|
79
|
+
- name: Install frontend dependencies
|
|
80
|
+
run: npm ci
|
|
81
|
+
working-directory: frontend
|
|
82
|
+
|
|
83
|
+
- name: Build frontend and copy to FastAPI dirs
|
|
84
|
+
run: bash scripts/build-frontend.sh
|
|
85
|
+
|
|
86
|
+
- name: Run frontend unit tests
|
|
87
|
+
run: npm test
|
|
88
|
+
working-directory: frontend
|
|
89
|
+
|
|
90
|
+
- name: Install Playwright browsers
|
|
91
|
+
run: npx playwright install --with-deps chromium
|
|
92
|
+
working-directory: frontend
|
|
93
|
+
|
|
94
|
+
- name: Run Playwright E2E tests
|
|
95
|
+
run: |
|
|
96
|
+
uv run datasight run &
|
|
97
|
+
for i in $(seq 1 30); do curl -s http://localhost:8084 > /dev/null && break; sleep 1; done
|
|
98
|
+
npm run test:e2e
|
|
99
|
+
working-directory: frontend
|
|
100
|
+
|
|
101
|
+
- name: Run Python tests
|
|
102
|
+
run: uv run pytest -q -m "not integration" --cov=datasight --cov-report=xml:coverage.xml
|
|
103
|
+
|
|
104
|
+
- name: Upload coverage to Codecov
|
|
105
|
+
uses: codecov/codecov-action@v4.2.0
|
|
106
|
+
with:
|
|
107
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
108
|
+
files: coverage.xml
|
|
109
|
+
name: datasight-tests
|
|
110
|
+
fail_ci_if_error: false
|
|
111
|
+
verbose: true
|
|
112
|
+
|
|
113
|
+
security:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- uses: actions/checkout@v4
|
|
117
|
+
|
|
118
|
+
- name: Install uv
|
|
119
|
+
uses: astral-sh/setup-uv@v4
|
|
120
|
+
with:
|
|
121
|
+
python-version: "3.13"
|
|
122
|
+
enable-cache: false
|
|
123
|
+
|
|
124
|
+
- name: Set up Node
|
|
125
|
+
uses: actions/setup-node@v4
|
|
126
|
+
with:
|
|
127
|
+
node-version: "22"
|
|
128
|
+
cache: npm
|
|
129
|
+
cache-dependency-path: frontend/package-lock.json
|
|
130
|
+
|
|
131
|
+
- name: Export Python dependencies
|
|
132
|
+
run: uv export --frozen --no-dev --no-emit-project --format requirements-txt -o requirements.txt
|
|
133
|
+
|
|
134
|
+
- name: Run pip-audit
|
|
135
|
+
uses: pypa/gh-action-pip-audit@v1.1.0
|
|
136
|
+
with:
|
|
137
|
+
inputs: requirements.txt
|
|
138
|
+
|
|
139
|
+
- name: Run npm audit
|
|
140
|
+
run: npm audit --omit=dev --audit-level=high
|
|
141
|
+
working-directory: frontend
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "21 6 * * 1"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
analyze:
|
|
13
|
+
name: Analyze (${{ matrix.language }})
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
actions: read
|
|
17
|
+
contents: read
|
|
18
|
+
security-events: write
|
|
19
|
+
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
include:
|
|
24
|
+
- language: python
|
|
25
|
+
build-mode: none
|
|
26
|
+
- language: javascript-typescript
|
|
27
|
+
build-mode: none
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
|
|
32
|
+
- name: Initialize CodeQL
|
|
33
|
+
uses: github/codeql-action/init@v3
|
|
34
|
+
with:
|
|
35
|
+
languages: ${{ matrix.language }}
|
|
36
|
+
build-mode: ${{ matrix.build-mode }}
|
|
37
|
+
queries: security-and-quality
|
|
38
|
+
|
|
39
|
+
- name: Perform CodeQL Analysis
|
|
40
|
+
uses: github/codeql-action/analyze@v3
|
|
41
|
+
with:
|
|
42
|
+
category: "/language:${{ matrix.language }}"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
make-pages:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v4
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.13"
|
|
17
|
+
enable-cache: true
|
|
18
|
+
|
|
19
|
+
- name: Install the project
|
|
20
|
+
run: |
|
|
21
|
+
mkdir -p src/datasight/web/static/assets
|
|
22
|
+
uv sync --extra dev --frozen
|
|
23
|
+
|
|
24
|
+
- name: Build documentation
|
|
25
|
+
run: uv run zensical build
|
|
26
|
+
|
|
27
|
+
- name: Deploy on GitHub Pages
|
|
28
|
+
uses: peaceiris/actions-gh-pages@v4.0.0
|
|
29
|
+
with:
|
|
30
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
31
|
+
publish_dir: ./site/
|
|
32
|
+
force_orphan: true
|
|
33
|
+
full_commit_message: ${{ github.event.head_commit.message }}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
name: Build and publish release
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v4
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.13"
|
|
23
|
+
enable-cache: true
|
|
24
|
+
|
|
25
|
+
- name: Set up Node
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: "22"
|
|
29
|
+
cache: npm
|
|
30
|
+
cache-dependency-path: frontend/package-lock.json
|
|
31
|
+
|
|
32
|
+
- name: Build frontend assets
|
|
33
|
+
run: bash scripts/build-frontend.sh
|
|
34
|
+
|
|
35
|
+
- name: Build Python distributions
|
|
36
|
+
run: uv build
|
|
37
|
+
|
|
38
|
+
- name: Create GitHub release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
files: dist/*
|
|
42
|
+
generate_release_notes: true
|
|
43
|
+
|
|
44
|
+
- name: Publish package distributions to PyPI
|
|
45
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
site/
|
|
2
|
+
.venv
|
|
3
|
+
__pycache__
|
|
4
|
+
.datasight/
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
.coverage
|
|
8
|
+
|
|
9
|
+
# Frontend build output (generated by scripts/build-frontend.sh)
|
|
10
|
+
src/datasight/web/static/assets/
|
|
11
|
+
src/datasight/web/static/datasight-icon.svg
|
|
12
|
+
src/datasight/web/templates/index.html
|
|
13
|
+
frontend/dist/
|
|
14
|
+
frontend/node_modules/
|
|
15
|
+
frontend/test-results/
|
|
16
|
+
frontend/playwright-report/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.15.8
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: local
|
|
10
|
+
hooks:
|
|
11
|
+
- id: ty
|
|
12
|
+
name: ty (type check)
|
|
13
|
+
entry: ty check
|
|
14
|
+
language: system
|
|
15
|
+
types: [python]
|
|
16
|
+
pass_filenames: false
|
|
17
|
+
- id: docs-cli-reference
|
|
18
|
+
name: docs CLI reference drift check
|
|
19
|
+
entry: uv run pytest tests/test_docs_cli_reference.py
|
|
20
|
+
language: system
|
|
21
|
+
files: ^(src/datasight/cli\.py|scripts/generate_cli_reference\.py|docs/reference/cli\.md)$
|
|
22
|
+
pass_filenames: false
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Project overview
|
|
4
|
+
|
|
5
|
+
datasight is an AI-powered data exploration tool. Users ask questions in natural language, an LLM agent translates them to SQL, executes queries, and returns results as tables or interactive Plotly charts. It supports a web UI (`datasight run`) and a headless CLI (`datasight ask`).
|
|
6
|
+
|
|
7
|
+
## Tech stack
|
|
8
|
+
|
|
9
|
+
- **Python 3.11+**, built with Hatchling (`pyproject.toml`). CI tests on 3.13 only.
|
|
10
|
+
- **FastAPI + uvicorn** for the web server with SSE streaming
|
|
11
|
+
- **Svelte 5 + TypeScript + Tailwind CSS** frontend — built with Vite, served by FastAPI
|
|
12
|
+
- **LLM backends**: Anthropic (default), GitHub Models, Ollama — all via a common `LLMClient` abstraction in `datasight.llm`
|
|
13
|
+
- **Database backends**: DuckDB (default), SQLite, PostgreSQL, Flight SQL — all via `SqlRunner` implementations in `datasight.runner`
|
|
14
|
+
- **Click CLI** with commands: `run`, `ask`, `init`, `demo`, `generate`, `verify`, `profile`, `quality`, `doctor`, `export`, `log`
|
|
15
|
+
|
|
16
|
+
## Repository layout
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/datasight/
|
|
20
|
+
├── cli.py # Click CLI commands
|
|
21
|
+
├── agent.py # Shared agent loop (web + CLI)
|
|
22
|
+
├── config.py # Configuration helpers, normalize_db_mode()
|
|
23
|
+
├── schema.py # Database introspection
|
|
24
|
+
├── llm.py # LLM client abstraction
|
|
25
|
+
├── chart.py # Plotly chart generator
|
|
26
|
+
├── runner.py # SQL execution backends
|
|
27
|
+
├── prompts.py # System prompt builder
|
|
28
|
+
├── sql_validation.py # SQL validation with sqlglot
|
|
29
|
+
├── export.py # Session-to-HTML export
|
|
30
|
+
├── verify.py # Query verification engine
|
|
31
|
+
├── demo.py # Demo dataset generator
|
|
32
|
+
└── web/
|
|
33
|
+
├── app.py # FastAPI server + SSE streaming
|
|
34
|
+
├── static/ # Generated Vite build output (ignored by git)
|
|
35
|
+
└── templates/ # Generated index.html (ignored by git)
|
|
36
|
+
frontend/ # Svelte 5 + TypeScript + Tailwind source
|
|
37
|
+
├── src/
|
|
38
|
+
│ ├── App.svelte # Root component
|
|
39
|
+
│ ├── main.ts # Entry point
|
|
40
|
+
│ ├── app.css # Tailwind + design tokens
|
|
41
|
+
│ └── lib/
|
|
42
|
+
│ ├── stores/ # Svelte 5 rune-based stores (8 modules)
|
|
43
|
+
│ ├── api/ # Typed API client functions (9 modules)
|
|
44
|
+
│ ├── components/ # ~40 Svelte components
|
|
45
|
+
│ └── utils/ # Search, format, markdown utilities
|
|
46
|
+
├── tests/ # Vitest unit tests
|
|
47
|
+
├── e2e/ # Playwright E2E tests
|
|
48
|
+
└── scripts/
|
|
49
|
+
└── build-frontend.sh # Build + copy to FastAPI dirs
|
|
50
|
+
tests/ # pytest + pytest-asyncio
|
|
51
|
+
docs/ # Zensical documentation
|
|
52
|
+
mkdocs.yml # Zensical config
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Development commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Primary workflow: uv creates .venv and installs project + dev extras
|
|
59
|
+
uv sync --extra dev
|
|
60
|
+
. .venv/bin/activate
|
|
61
|
+
|
|
62
|
+
# Run prek hooks (ruff, ruff-format, ty, docs CLI reference drift)
|
|
63
|
+
prek run --all-files
|
|
64
|
+
|
|
65
|
+
# Build docs
|
|
66
|
+
zensical serve # dev server at localhost:8000
|
|
67
|
+
zensical build
|
|
68
|
+
|
|
69
|
+
# Regenerate the static CLI reference after CLI changes
|
|
70
|
+
python scripts/generate_cli_reference.py
|
|
71
|
+
|
|
72
|
+
# Run Python tests
|
|
73
|
+
pytest
|
|
74
|
+
|
|
75
|
+
# Run CI-safe Python tests, excluding local Ollama integration tests
|
|
76
|
+
pytest -m "not integration"
|
|
77
|
+
|
|
78
|
+
# Run web UI smoke tests
|
|
79
|
+
pytest -q tests/test_web_ui_smoke.py
|
|
80
|
+
|
|
81
|
+
# Frontend development
|
|
82
|
+
cd frontend
|
|
83
|
+
npm install
|
|
84
|
+
npm run dev # Vite dev server on :5173 (proxies /api to :8084)
|
|
85
|
+
npm run check # Svelte + TypeScript checks
|
|
86
|
+
npm test # Vitest unit tests
|
|
87
|
+
npm run build # Production build
|
|
88
|
+
|
|
89
|
+
# Build frontend for FastAPI serving after a clean checkout or frontend changes
|
|
90
|
+
bash scripts/build-frontend.sh
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Pre-commit hooks
|
|
94
|
+
|
|
95
|
+
Hooks run automatically on commit. Don't skip them — fix issues instead.
|
|
96
|
+
|
|
97
|
+
- **ruff** — Python lint + format. Auto-fixes on failure; re-stage and commit.
|
|
98
|
+
- **ruff-format** — Python formatting.
|
|
99
|
+
- **ty** — Python type checking. Optional imports (like `psycopg`) need `# ty: ignore[unresolved-import]`.
|
|
100
|
+
- **docs CLI reference drift** — Ensures `docs/reference/cli.md` stays aligned with the current Click command tree.
|
|
101
|
+
|
|
102
|
+
## Code conventions
|
|
103
|
+
|
|
104
|
+
- **DB_MODE values**: `duckdb`, `sqlite`, `postgres`, `flightsql`. The legacy value `local` is accepted as a silent alias for `duckdb` via `normalize_db_mode()` in `config.py`.
|
|
105
|
+
- **SQL dialect**: Tracked as `sql_dialect` (values: `duckdb`, `sqlite`, `postgres`). Mapped from `db_mode` via `_db_mode_dialects` dicts.
|
|
106
|
+
- **Frontend**: Svelte 5 with TypeScript in `frontend/`. Components use runes API (`$state`, `$derived`, `$effect`, `$props`). Stores are factory functions with getter/setter pairs wrapping `$state()`. Tailwind CSS for styling with design tokens in `app.css`. Build with `scripts/build-frontend.sh` which copies Vite output to FastAPI's `static/` and `templates/` dirs. Generated files in `src/datasight/web/static/` and `src/datasight/web/templates/index.html` are ignored by git; run the script after a clean checkout before serving the production UI with `datasight run`.
|
|
107
|
+
|
|
108
|
+
## CI and release workflows
|
|
109
|
+
|
|
110
|
+
- `.github/workflows/ci.yml` runs a Ruff/ty/frontend type-check lint job, builds the frontend, runs Vitest, runs Playwright E2E tests against `datasight run`, runs pytest with coverage, and uploads `coverage.xml` to Codecov.
|
|
111
|
+
- `.github/workflows/gh-pages.yml` builds and deploys Zensical documentation to GitHub Pages on pushes to `main`.
|
|
112
|
+
- `.github/workflows/release.yml` runs on `v*` tags, builds frontend assets, builds Python sdist/wheel distributions, creates a GitHub release, and publishes to PyPI. Hatch includes the generated frontend files as build artifacts, so do not commit bundled frontend output.
|
|
113
|
+
- **Keyboard shortcuts**: Must not conflict with browser shortcuts. Use plain keys (like `n`, `/`, `?`) guarded by `isInput` check, or `Cmd/Ctrl+key` combos that browsers don't claim.
|
|
114
|
+
- **Type annotations**: Use modern Python syntax — `list[str]`, `dict[str, Any]`, `str | None`. Do not use `List`, `Dict`, `Optional`, `Union`, or other imports from `typing` when a built-in equivalent exists.
|
|
115
|
+
|
|
116
|
+
## Documentation domain
|
|
117
|
+
|
|
118
|
+
datasight is built for energy research. Documentation examples, CLI help text, and sample prompts should use energy-domain language (generation, fuel types, plants, MWh, capacity) — not generic retail/sales/orders examples. When writing new examples or updating existing ones, use tables like `generation_fuel`, `plants`, columns like `net_generation_mwh`, `report_date`, `energy_source_code`, and questions about electricity generation, capacity, or fuel consumption.
|
|
119
|
+
|
|
120
|
+
## Documentation
|
|
121
|
+
|
|
122
|
+
Docs use **Zensical**. Key details:
|
|
123
|
+
|
|
124
|
+
- Config: `mkdocs.yml`
|
|
125
|
+
- Source content lives in `docs/` as standard Markdown
|
|
126
|
+
- Serve docs locally with `zensical serve`
|
|
127
|
+
- Build docs with `zensical build`
|
|
128
|
+
- Mermaid diagrams: use ` ```mermaid ` fences
|
|
129
|
+
- Admonitions: use `!!! tip`, `!!! warning`
|
|
130
|
+
- Icons: use `:material-icon-name:` and `:octicons-icon-name:` (requires `pymdownx.emoji` extension)
|
|
131
|
+
- `docs/reference/cli.md` is generated from the Click command tree with `python scripts/generate_cli_reference.py`
|
|
132
|
+
- CI: `.github/workflows/gh-pages.yml` builds the site with `zensical build` and deploys to GitHub Pages on push to main
|
|
133
|
+
|
|
134
|
+
## Testing
|
|
135
|
+
|
|
136
|
+
- **pytest + pytest-asyncio** with `asyncio_mode = "auto"`
|
|
137
|
+
- **Integration marker**: tests marked `integration` require a running local Ollama instance with `qwen2.5:7b` available and are excluded in CI with `pytest -m "not integration"`. New tests that call a live LLM provider must be marked `integration`; prefer fake/stub LLM clients for deterministic unit tests.
|
|
138
|
+
- **Vitest** for frontend unit tests (`frontend/tests/`). Run with `cd frontend && npm test`.
|
|
139
|
+
- **Playwright** for frontend E2E tests (`frontend/e2e/`). Requires `datasight run` to be running. Run with `cd frontend && npm run test:e2e`.
|
|
140
|
+
- **Web UI smoke tests** live in `tests/test_web_ui_smoke.py` and exercise the rendered FastAPI app without a browser build step
|
|
141
|
+
- Integration tests (marked `@pytest.mark.integration`) require a running Ollama instance
|
|
142
|
+
- Test fixtures in `tests/conftest.py` create a temporary DuckDB project directory
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Project overview
|
|
4
|
+
|
|
5
|
+
datasight is an AI-powered data exploration tool. Users ask questions in natural language, an LLM agent translates them to SQL, executes queries, and returns results as tables or interactive Plotly charts. It supports a web UI (`datasight run`) and a headless CLI (`datasight ask`).
|
|
6
|
+
|
|
7
|
+
## Tech stack
|
|
8
|
+
|
|
9
|
+
- **Python 3.11+**, built with Hatchling (`pyproject.toml`). CI tests on 3.13 only.
|
|
10
|
+
- **FastAPI + uvicorn** for the web server with SSE streaming
|
|
11
|
+
- **Svelte 5 + TypeScript + Tailwind CSS** frontend — built with Vite, served by FastAPI
|
|
12
|
+
- **LLM backends**: Anthropic (default), GitHub Models, Ollama — all via a common `LLMClient` abstraction in `datasight.llm`
|
|
13
|
+
- **Database backends**: DuckDB (default), SQLite, PostgreSQL, Flight SQL — all via `SqlRunner` implementations in `datasight.runner`
|
|
14
|
+
- **Click CLI** with commands: `run`, `ask`, `init`, `demo`, `generate`, `verify`, `profile`, `quality`, `doctor`, `export`, `log`
|
|
15
|
+
|
|
16
|
+
## Repository layout
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/datasight/
|
|
20
|
+
├── cli.py # Click CLI commands
|
|
21
|
+
├── agent.py # Shared agent loop (web + CLI)
|
|
22
|
+
├── config.py # Configuration helpers, normalize_db_mode()
|
|
23
|
+
├── schema.py # Database introspection
|
|
24
|
+
├── llm.py # LLM client abstraction
|
|
25
|
+
├── chart.py # Plotly chart generator
|
|
26
|
+
├── runner.py # SQL execution backends
|
|
27
|
+
├── prompts.py # System prompt builder
|
|
28
|
+
├── sql_validation.py # SQL validation with sqlglot
|
|
29
|
+
├── export.py # Session-to-HTML export
|
|
30
|
+
├── verify.py # Query verification engine
|
|
31
|
+
├── demo.py # Demo dataset generator
|
|
32
|
+
└── web/
|
|
33
|
+
├── app.py # FastAPI server + SSE streaming
|
|
34
|
+
├── static/ # Generated Vite build output (ignored by git)
|
|
35
|
+
└── templates/ # Generated index.html (ignored by git)
|
|
36
|
+
frontend/ # Svelte 5 + TypeScript + Tailwind source
|
|
37
|
+
├── src/
|
|
38
|
+
│ ├── App.svelte # Root component
|
|
39
|
+
│ ├── main.ts # Entry point
|
|
40
|
+
│ ├── app.css # Tailwind + design tokens
|
|
41
|
+
│ └── lib/
|
|
42
|
+
│ ├── stores/ # Svelte 5 rune-based stores (8 modules)
|
|
43
|
+
│ ├── api/ # Typed API client functions (9 modules)
|
|
44
|
+
│ ├── components/ # ~40 Svelte components
|
|
45
|
+
│ └── utils/ # Search, format, markdown utilities
|
|
46
|
+
├── tests/ # Vitest unit tests
|
|
47
|
+
├── e2e/ # Playwright E2E tests
|
|
48
|
+
└── scripts/
|
|
49
|
+
└── build-frontend.sh # Build + copy to FastAPI dirs
|
|
50
|
+
tests/ # pytest + pytest-asyncio
|
|
51
|
+
docs/ # Zensical documentation
|
|
52
|
+
mkdocs.yml # Zensical config
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Development commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Primary workflow: uv creates .venv and installs project + dev extras
|
|
59
|
+
uv sync --extra dev
|
|
60
|
+
. .venv/bin/activate
|
|
61
|
+
|
|
62
|
+
# Run prek hooks (ruff, ruff-format, ty, docs CLI reference drift)
|
|
63
|
+
prek run --all-files
|
|
64
|
+
|
|
65
|
+
# Build docs
|
|
66
|
+
zensical serve # dev server at localhost:8000
|
|
67
|
+
zensical build
|
|
68
|
+
|
|
69
|
+
# Run Python tests
|
|
70
|
+
pytest
|
|
71
|
+
|
|
72
|
+
# Run CI-safe Python tests, excluding local Ollama integration tests
|
|
73
|
+
pytest -m "not integration"
|
|
74
|
+
|
|
75
|
+
# Run web UI smoke tests
|
|
76
|
+
pytest -q tests/test_web_ui_smoke.py
|
|
77
|
+
|
|
78
|
+
# Frontend development
|
|
79
|
+
cd frontend
|
|
80
|
+
npm install
|
|
81
|
+
npm run dev # Vite dev server on :5173 (proxies /api to :8084)
|
|
82
|
+
npm run check # Svelte + TypeScript checks
|
|
83
|
+
npm test # Vitest unit tests (47 tests)
|
|
84
|
+
npm run build # Production build
|
|
85
|
+
|
|
86
|
+
# Build frontend for FastAPI serving after a clean checkout or frontend changes
|
|
87
|
+
bash scripts/build-frontend.sh
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Pre-commit hooks
|
|
91
|
+
|
|
92
|
+
Hooks run automatically on commit. Don't skip them — fix issues instead.
|
|
93
|
+
|
|
94
|
+
- **ruff** — Python lint + format. Auto-fixes on failure; re-stage and commit.
|
|
95
|
+
- **ruff-format** — Python formatting.
|
|
96
|
+
- **ty** — Python type checking. Optional imports (like `psycopg`) need `# ty: ignore[unresolved-import]`.
|
|
97
|
+
- **docs CLI reference drift** — Ensures `docs/reference/cli.md` stays aligned with the current Click command tree.
|
|
98
|
+
|
|
99
|
+
## Code conventions
|
|
100
|
+
|
|
101
|
+
- **DB_MODE values**: `duckdb`, `sqlite`, `postgres`, `flightsql`. The legacy value `local` is accepted as a silent alias for `duckdb` via `normalize_db_mode()` in `config.py`.
|
|
102
|
+
- **SQL dialect**: Tracked as `sql_dialect` (values: `duckdb`, `sqlite`, `postgres`). Mapped from `db_mode` via `_db_mode_dialects` dicts.
|
|
103
|
+
- **Frontend**: Svelte 5 with TypeScript in `frontend/`. Components use runes API (`$state`, `$derived`, `$effect`, `$props`). Stores are factory functions with getter/setter pairs wrapping `$state()`. Tailwind CSS for styling with design tokens in `app.css`. Build with `scripts/build-frontend.sh` which copies Vite output to FastAPI's `static/` and `templates/` dirs. Generated files in `src/datasight/web/static/` and `src/datasight/web/templates/index.html` are ignored by git; run the script after a clean checkout before serving the production UI with `datasight run`.
|
|
104
|
+
- **Keyboard shortcuts**: Must not conflict with browser shortcuts. Use plain keys (like `n`, `/`, `?`) guarded by `isInput` check, or `Cmd/Ctrl+key` combos that browsers don't claim.
|
|
105
|
+
- **Type annotations**: Use modern Python syntax — `list[str]`, `dict[str, Any]`, `str | None`. Do not use `List`, `Dict`, `Optional`, `Union`, or other imports from `typing` when a built-in equivalent exists.
|
|
106
|
+
|
|
107
|
+
## Documentation domain
|
|
108
|
+
|
|
109
|
+
datasight is built for energy research. Documentation examples, CLI help text, and sample prompts should use energy-domain language (generation, fuel types, plants, MWh, capacity) — not generic retail/sales/orders examples. When writing new examples or updating existing ones, use tables like `generation_fuel`, `plants`, columns like `net_generation_mwh`, `report_date`, `energy_source_code`, and questions about electricity generation, capacity, or fuel consumption.
|
|
110
|
+
|
|
111
|
+
## Documentation
|
|
112
|
+
|
|
113
|
+
Docs use **Zensical**. Key details:
|
|
114
|
+
|
|
115
|
+
- Config: `mkdocs.yml`
|
|
116
|
+
- Content: `docs/` directory, standard Markdown
|
|
117
|
+
- Mermaid diagrams: use ` ```mermaid ` fences
|
|
118
|
+
- Admonitions: use `!!! tip`, `!!! warning`
|
|
119
|
+
- CLI reference: `docs/reference/cli.md` is generated from the Click command tree with `python scripts/generate_cli_reference.py`
|
|
120
|
+
- Icons: use `:material-icon-name:` and `:octicons-icon-name:` (requires `pymdownx.emoji` extension)
|
|
121
|
+
- CI: `.github/workflows/gh-pages.yml` deploys to GitHub Pages on push to main
|
|
122
|
+
|
|
123
|
+
## CI and release workflows
|
|
124
|
+
|
|
125
|
+
`.github/workflows/ci.yml` runs on push/PR to `main`:
|
|
126
|
+
1. Runs Ruff lint, Ruff format check, ty type checking, and Svelte/TypeScript checks
|
|
127
|
+
2. Builds frontend via `scripts/build-frontend.sh` (npm ci + vite build + copy to FastAPI dirs)
|
|
128
|
+
3. Runs Vitest unit tests (`npm test`)
|
|
129
|
+
4. Installs Playwright Chromium and runs E2E tests against a live `datasight run` server
|
|
130
|
+
5. Runs pytest with coverage, excluding `integration` tests, and uploads `coverage.xml` to Codecov
|
|
131
|
+
|
|
132
|
+
`.github/workflows/gh-pages.yml` deploys Zensical documentation to GitHub Pages
|
|
133
|
+
on pushes to `main`.
|
|
134
|
+
|
|
135
|
+
`.github/workflows/release.yml` runs on `v*` tags, builds frontend assets,
|
|
136
|
+
builds Python sdist/wheel distributions, creates a GitHub release, and
|
|
137
|
+
publishes to PyPI. Hatch includes the generated frontend files as build
|
|
138
|
+
artifacts, so do not commit bundled frontend output.
|
|
139
|
+
|
|
140
|
+
## Testing
|
|
141
|
+
|
|
142
|
+
- **pytest + pytest-asyncio** with `asyncio_mode = "auto"`
|
|
143
|
+
- **Integration marker**: tests marked `integration` require a running local Ollama instance with `qwen2.5:7b` available and are excluded in CI with `pytest -m "not integration"`. New tests that call a live LLM provider must be marked `integration`; prefer fake/stub LLM clients for deterministic unit tests.
|
|
144
|
+
- **Vitest** for frontend unit tests (`frontend/tests/`). Run with `cd frontend && npm test`.
|
|
145
|
+
- **Playwright** for frontend E2E tests (`frontend/e2e/`). Requires `datasight run` to be running. Run with `cd frontend && npm run test:e2e`.
|
|
146
|
+
- **Web UI smoke tests** live in `tests/test_web_ui_smoke.py` and exercise the rendered FastAPI app without a browser build step
|
|
147
|
+
- Integration tests (marked `@pytest.mark.integration`) require a running Ollama instance
|
|
148
|
+
- Test fixtures in `tests/conftest.py` create a temporary DuckDB project directory
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
This software was generated using artificial intelligence. It may (i) contain errors or inaccuracies; (ii) not follow standard human-authored patterns; (iii) not be free of latent security vulnerabilities; and/or (iv) be optimized for all environments. Users are advised to perform comprehensive audits before using this software.
|
|
2
|
+
|
|
3
|
+
Users acknowledge that as an artificial intelligence tool, the software (i) may produce inaccurate, incomplete, or biased information; (ii) may “hallucinate” facts or generate code/text that is illogical or flawed; and/or (iii) may yield different results with the same input on repeated uses.
|
|
4
|
+
|
|
5
|
+
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ALLIANCE FOR ENERGY INNOVATION, LLC OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USE AT YOUR OWN RISK.
|
datasight-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Alliance for Energy Innovation, LLC
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|