insyte 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 (193) hide show
  1. insyte-0.1.0/.github/workflows/release.yml +29 -0
  2. insyte-0.1.0/.gitignore +42 -0
  3. insyte-0.1.0/CONTRIBUTING.md +41 -0
  4. insyte-0.1.0/LICENSE +201 -0
  5. insyte-0.1.0/PKG-INFO +363 -0
  6. insyte-0.1.0/README.md +112 -0
  7. insyte-0.1.0/SECURITY.md +41 -0
  8. insyte-0.1.0/docs/PUBLISHING.md +217 -0
  9. insyte-0.1.0/docs/QUICKSTART.md +104 -0
  10. insyte-0.1.0/docs/mcp.md +64 -0
  11. insyte-0.1.0/examples/config.example.yaml +47 -0
  12. insyte-0.1.0/frontend/README.md +37 -0
  13. insyte-0.1.0/frontend/index.html +13 -0
  14. insyte-0.1.0/frontend/package.json +33 -0
  15. insyte-0.1.0/frontend/src/App.tsx +45 -0
  16. insyte-0.1.0/frontend/src/main.tsx +9 -0
  17. insyte-0.1.0/frontend/tsconfig.json +19 -0
  18. insyte-0.1.0/frontend/vite.config.ts +17 -0
  19. insyte-0.1.0/pyproject.toml +104 -0
  20. insyte-0.1.0/src/insyte/__init__.py +12 -0
  21. insyte-0.1.0/src/insyte/analytics/__init__.py +21 -0
  22. insyte-0.1.0/src/insyte/analytics/charts.py +67 -0
  23. insyte-0.1.0/src/insyte/analytics/comparison.py +64 -0
  24. insyte-0.1.0/src/insyte/analytics/engine.py +195 -0
  25. insyte-0.1.0/src/insyte/analytics/forecast.py +58 -0
  26. insyte-0.1.0/src/insyte/analytics/models.py +90 -0
  27. insyte-0.1.0/src/insyte/analytics/periods.py +46 -0
  28. insyte-0.1.0/src/insyte/analytics/segmentation.py +40 -0
  29. insyte-0.1.0/src/insyte/cli/__init__.py +1 -0
  30. insyte-0.1.0/src/insyte/cli/_project.py +43 -0
  31. insyte-0.1.0/src/insyte/cli/_stubs.py +42 -0
  32. insyte-0.1.0/src/insyte/cli/analyze_command.py +165 -0
  33. insyte-0.1.0/src/insyte/cli/app.py +84 -0
  34. insyte-0.1.0/src/insyte/cli/chat_command.py +68 -0
  35. insyte-0.1.0/src/insyte/cli/connect_command.py +147 -0
  36. insyte-0.1.0/src/insyte/cli/doctor_command.py +127 -0
  37. insyte-0.1.0/src/insyte/cli/history_command.py +89 -0
  38. insyte-0.1.0/src/insyte/cli/init_command.py +268 -0
  39. insyte-0.1.0/src/insyte/cli/mcp_command.py +150 -0
  40. insyte-0.1.0/src/insyte/cli/metrics_command.py +95 -0
  41. insyte-0.1.0/src/insyte/cli/profile_command.py +128 -0
  42. insyte-0.1.0/src/insyte/cli/query_command.py +115 -0
  43. insyte-0.1.0/src/insyte/cli/scan_command.py +101 -0
  44. insyte-0.1.0/src/insyte/cli/schema_command.py +189 -0
  45. insyte-0.1.0/src/insyte/cli/semantic_command.py +101 -0
  46. insyte-0.1.0/src/insyte/cli/status_command.py +88 -0
  47. insyte-0.1.0/src/insyte/cli/studio_command.py +110 -0
  48. insyte-0.1.0/src/insyte/cli/sync_command.py +187 -0
  49. insyte-0.1.0/src/insyte/config/__init__.py +1 -0
  50. insyte-0.1.0/src/insyte/config/loader.py +96 -0
  51. insyte-0.1.0/src/insyte/config/models.py +153 -0
  52. insyte-0.1.0/src/insyte/config/paths.py +119 -0
  53. insyte-0.1.0/src/insyte/config/secrets.py +82 -0
  54. insyte-0.1.0/src/insyte/connectors/__init__.py +19 -0
  55. insyte-0.1.0/src/insyte/connectors/base.py +96 -0
  56. insyte-0.1.0/src/insyte/connectors/duckdb.py +74 -0
  57. insyte-0.1.0/src/insyte/connectors/factory.py +37 -0
  58. insyte-0.1.0/src/insyte/connectors/postgres.py +284 -0
  59. insyte-0.1.0/src/insyte/exceptions.py +112 -0
  60. insyte-0.1.0/src/insyte/logging_config.py +131 -0
  61. insyte-0.1.0/src/insyte/main.py +15 -0
  62. insyte-0.1.0/src/insyte/mcp/__init__.py +6 -0
  63. insyte-0.1.0/src/insyte/mcp/installer.py +130 -0
  64. insyte-0.1.0/src/insyte/mcp/server.py +91 -0
  65. insyte-0.1.0/src/insyte/mcp/tools.py +331 -0
  66. insyte-0.1.0/src/insyte/metadata/__init__.py +6 -0
  67. insyte-0.1.0/src/insyte/metadata/classifier.py +89 -0
  68. insyte-0.1.0/src/insyte/metadata/models.py +523 -0
  69. insyte-0.1.0/src/insyte/metadata/pii_detector.py +106 -0
  70. insyte-0.1.0/src/insyte/metadata/profiler.py +209 -0
  71. insyte-0.1.0/src/insyte/metadata/relationship_detector.py +164 -0
  72. insyte-0.1.0/src/insyte/metadata/repository.py +681 -0
  73. insyte-0.1.0/src/insyte/metadata/scanner.py +256 -0
  74. insyte-0.1.0/src/insyte/nl/__init__.py +7 -0
  75. insyte-0.1.0/src/insyte/nl/llm.py +304 -0
  76. insyte-0.1.0/src/insyte/nl/periods.py +92 -0
  77. insyte-0.1.0/src/insyte/query/__init__.py +13 -0
  78. insyte-0.1.0/src/insyte/query/cost_guard.py +66 -0
  79. insyte-0.1.0/src/insyte/query/executor.py +171 -0
  80. insyte-0.1.0/src/insyte/query/generator.py +200 -0
  81. insyte-0.1.0/src/insyte/query/models.py +72 -0
  82. insyte-0.1.0/src/insyte/query/validator.py +300 -0
  83. insyte-0.1.0/src/insyte/semantic/__init__.py +28 -0
  84. insyte-0.1.0/src/insyte/semantic/generator.py +197 -0
  85. insyte-0.1.0/src/insyte/semantic/models.py +72 -0
  86. insyte-0.1.0/src/insyte/semantic/repository.py +34 -0
  87. insyte-0.1.0/src/insyte/semantic/validator.py +117 -0
  88. insyte-0.1.0/src/insyte/services/__init__.py +30 -0
  89. insyte-0.1.0/src/insyte/services/analysis_service.py +43 -0
  90. insyte-0.1.0/src/insyte/services/conversation_service.py +79 -0
  91. insyte-0.1.0/src/insyte/services/export_service.py +25 -0
  92. insyte-0.1.0/src/insyte/services/history_service.py +19 -0
  93. insyte-0.1.0/src/insyte/services/metric_service.py +37 -0
  94. insyte-0.1.0/src/insyte/services/project_service.py +83 -0
  95. insyte-0.1.0/src/insyte/services/schema_service.py +86 -0
  96. insyte-0.1.0/src/insyte/studio/__init__.py +5 -0
  97. insyte-0.1.0/src/insyte/studio/app.py +107 -0
  98. insyte-0.1.0/src/insyte/studio/dependencies.py +26 -0
  99. insyte-0.1.0/src/insyte/studio/events.py +271 -0
  100. insyte-0.1.0/src/insyte/studio/routes/__init__.py +1 -0
  101. insyte-0.1.0/src/insyte/studio/routes/analysis.py +102 -0
  102. insyte-0.1.0/src/insyte/studio/routes/conversations.py +87 -0
  103. insyte-0.1.0/src/insyte/studio/routes/exports.py +37 -0
  104. insyte-0.1.0/src/insyte/studio/routes/history.py +37 -0
  105. insyte-0.1.0/src/insyte/studio/routes/metrics.py +50 -0
  106. insyte-0.1.0/src/insyte/studio/routes/project.py +71 -0
  107. insyte-0.1.0/src/insyte/studio/routes/schema.py +77 -0
  108. insyte-0.1.0/src/insyte/studio/routes/sync.py +37 -0
  109. insyte-0.1.0/src/insyte/studio/schemas.py +244 -0
  110. insyte-0.1.0/src/insyte/studio/static.py +31 -0
  111. insyte-0.1.0/src/insyte/studio_dist/assets/app.css +276 -0
  112. insyte-0.1.0/src/insyte/studio_dist/assets/app.js +635 -0
  113. insyte-0.1.0/src/insyte/studio_dist/assets/logo-dark.png +0 -0
  114. insyte-0.1.0/src/insyte/studio_dist/assets/logo-light.png +0 -0
  115. insyte-0.1.0/src/insyte/studio_dist/index.html +15 -0
  116. insyte-0.1.0/src/insyte/tui/__init__.py +6 -0
  117. insyte-0.1.0/src/insyte/tui/app.py +27 -0
  118. insyte-0.1.0/src/insyte/tui/controller.py +310 -0
  119. insyte-0.1.0/src/insyte/tui/intent.py +176 -0
  120. insyte-0.1.0/src/insyte/tui/screens/__init__.py +1 -0
  121. insyte-0.1.0/src/insyte/tui/screens/chat.py +123 -0
  122. insyte-0.1.0/src/insyte/tui/styles/app.tcss +101 -0
  123. insyte-0.1.0/src/insyte/tui/widgets/__init__.py +1 -0
  124. insyte-0.1.0/src/insyte/tui/widgets/chart_panel.py +38 -0
  125. insyte-0.1.0/src/insyte/tui/widgets/prompt_input.py +15 -0
  126. insyte-0.1.0/src/insyte/tui/widgets/result_card.py +63 -0
  127. insyte-0.1.0/src/insyte/tui/widgets/sidebar.py +27 -0
  128. insyte-0.1.0/src/insyte/tui/widgets/sql_panel.py +18 -0
  129. insyte-0.1.0/src/insyte/tui/widgets/status_bar.py +15 -0
  130. insyte-0.1.0/src/insyte/tui/widgets/table_panel.py +38 -0
  131. insyte-0.1.0/src/insyte/warehouse/__init__.py +8 -0
  132. insyte-0.1.0/src/insyte/warehouse/duckdb_manager.py +75 -0
  133. insyte-0.1.0/src/insyte/warehouse/extractor.py +116 -0
  134. insyte-0.1.0/src/insyte/warehouse/model_builder.py +20 -0
  135. insyte-0.1.0/src/insyte/warehouse/sync_engine.py +129 -0
  136. insyte-0.1.0/src/insyte/warehouse/sync_state.py +38 -0
  137. insyte-0.1.0/tests/conftest.py +24 -0
  138. insyte-0.1.0/tests/fixtures/__init__.py +0 -0
  139. insyte-0.1.0/tests/fixtures/ecommerce.sql +90 -0
  140. insyte-0.1.0/tests/fixtures/semantic.yaml +46 -0
  141. insyte-0.1.0/tests/integration/.gitkeep +1 -0
  142. insyte-0.1.0/tests/integration/test_analytics.py +87 -0
  143. insyte-0.1.0/tests/integration/test_postgres_connection.py +55 -0
  144. insyte-0.1.0/tests/integration/test_profiling.py +85 -0
  145. insyte-0.1.0/tests/integration/test_query_execution.py +92 -0
  146. insyte-0.1.0/tests/integration/test_scan.py +89 -0
  147. insyte-0.1.0/tests/integration/test_studio.py +96 -0
  148. insyte-0.1.0/tests/integration/test_sync.py +94 -0
  149. insyte-0.1.0/tests/security/.gitkeep +1 -0
  150. insyte-0.1.0/tests/security/test_sql_injection.py +76 -0
  151. insyte-0.1.0/tests/unit/test_analytics_engine.py +128 -0
  152. insyte-0.1.0/tests/unit/test_analytics_helpers.py +74 -0
  153. insyte-0.1.0/tests/unit/test_analyze_metrics_commands.py +92 -0
  154. insyte-0.1.0/tests/unit/test_audit_repository.py +90 -0
  155. insyte-0.1.0/tests/unit/test_chat_controller.py +195 -0
  156. insyte-0.1.0/tests/unit/test_classifier.py +88 -0
  157. insyte-0.1.0/tests/unit/test_cli.py +108 -0
  158. insyte-0.1.0/tests/unit/test_config_models.py +104 -0
  159. insyte-0.1.0/tests/unit/test_connect_command.py +137 -0
  160. insyte-0.1.0/tests/unit/test_cost_guard.py +42 -0
  161. insyte-0.1.0/tests/unit/test_forecast.py +50 -0
  162. insyte-0.1.0/tests/unit/test_generator.py +85 -0
  163. insyte-0.1.0/tests/unit/test_intent.py +104 -0
  164. insyte-0.1.0/tests/unit/test_loader.py +75 -0
  165. insyte-0.1.0/tests/unit/test_logging.py +54 -0
  166. insyte-0.1.0/tests/unit/test_mcp_installer.py +77 -0
  167. insyte-0.1.0/tests/unit/test_mcp_server.py +23 -0
  168. insyte-0.1.0/tests/unit/test_mcp_service.py +242 -0
  169. insyte-0.1.0/tests/unit/test_metadata_repository.py +149 -0
  170. insyte-0.1.0/tests/unit/test_nl_llm.py +203 -0
  171. insyte-0.1.0/tests/unit/test_nl_periods.py +72 -0
  172. insyte-0.1.0/tests/unit/test_paths.py +44 -0
  173. insyte-0.1.0/tests/unit/test_periods.py +43 -0
  174. insyte-0.1.0/tests/unit/test_pii_detector.py +50 -0
  175. insyte-0.1.0/tests/unit/test_postgres_connector.py +101 -0
  176. insyte-0.1.0/tests/unit/test_profile_semantic_commands.py +166 -0
  177. insyte-0.1.0/tests/unit/test_profiler.py +166 -0
  178. insyte-0.1.0/tests/unit/test_query_executor.py +129 -0
  179. insyte-0.1.0/tests/unit/test_query_history_commands.py +116 -0
  180. insyte-0.1.0/tests/unit/test_query_validator.py +91 -0
  181. insyte-0.1.0/tests/unit/test_relationship_detector.py +120 -0
  182. insyte-0.1.0/tests/unit/test_scan_schema_commands.py +144 -0
  183. insyte-0.1.0/tests/unit/test_scanner_filters.py +29 -0
  184. insyte-0.1.0/tests/unit/test_secrets.py +74 -0
  185. insyte-0.1.0/tests/unit/test_semantic.py +63 -0
  186. insyte-0.1.0/tests/unit/test_semantic_generator.py +158 -0
  187. insyte-0.1.0/tests/unit/test_services.py +160 -0
  188. insyte-0.1.0/tests/unit/test_studio_api.py +355 -0
  189. insyte-0.1.0/tests/unit/test_studio_command.py +49 -0
  190. insyte-0.1.0/tests/unit/test_sync_command.py +155 -0
  191. insyte-0.1.0/tests/unit/test_tui_app.py +78 -0
  192. insyte-0.1.0/tests/unit/test_warehouse.py +183 -0
  193. insyte-0.1.0/uv.lock +1770 -0
@@ -0,0 +1,29 @@
1
+ name: Release to PyPI
2
+
3
+ # Publishes to PyPI when you push a version tag (e.g. `git tag v0.1.0 && git push --tags`).
4
+ # Uses PyPI Trusted Publishing (OIDC) — no API token needed once configured:
5
+ # PyPI → project "insyte" → Settings → Publishing → add this repo as a trusted publisher
6
+ # (workflow: release.yml, environment: pypi).
7
+
8
+ on:
9
+ push:
10
+ tags:
11
+ - "v*"
12
+
13
+ jobs:
14
+ build-and-publish:
15
+ runs-on: ubuntu-latest
16
+ environment: pypi
17
+ permissions:
18
+ id-token: write # required for Trusted Publishing
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: astral-sh/setup-uv@v5
22
+ - name: Build
23
+ run: uv build
24
+ - name: Verify the wheel bundles the Studio SPA + logos
25
+ run: |
26
+ python -m zipfile -l dist/*.whl | grep studio_dist/assets/app.js
27
+ python -m zipfile -l dist/*.whl | grep studio_dist/assets/logo-dark.png
28
+ - name: Publish to PyPI
29
+ run: uv publish
@@ -0,0 +1,42 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ *.egg
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # Tooling caches
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .coverage
20
+ htmlcov/
21
+ coverage.xml
22
+
23
+ # Insyte local data (should never be committed)
24
+ .insyte/
25
+ *.sqlite
26
+ *.duckdb
27
+ *.parquet
28
+
29
+ # Frontend (Node) — build output ships in src/insyte/studio_dist, not here
30
+ frontend/node_modules/
31
+ frontend/dist/
32
+ frontend/.vite/
33
+
34
+ # Logo source files (the processed versions ship under src/insyte/studio_dist/assets/)
35
+ /dark-bg.png
36
+ /light-bg.png
37
+ /ChatGPT Image*.png
38
+
39
+ # Editors / OS
40
+ .idea/
41
+ .vscode/
42
+ .DS_Store
@@ -0,0 +1,41 @@
1
+ # Contributing to Insyte
2
+
3
+ Thanks for your interest in improving Insyte! This project is built milestone by milestone
4
+ (see the roadmap in the [README](README.md)).
5
+
6
+ ## Development setup
7
+
8
+ ```bash
9
+ git clone https://github.com/insyte-ai/insyte
10
+ cd insyte
11
+ uv venv && source .venv/bin/activate
12
+ uv pip install -e '.[dev]' # or: pip install -e '.[dev]'
13
+ uv run ruff check src tests && uv run mypy src && uv run pytest -q
14
+ ```
15
+
16
+ ## Standards
17
+
18
+ - **Type hints** on all public functions; code must pass `mypy src`.
19
+ - **Formatting & linting** via Ruff: `ruff check src tests` and `ruff format src tests`.
20
+ - **Tests** via Pytest: `pytest -q`. New behaviour needs tests.
21
+ - Keep modules small and focused; use custom exceptions (`insyte.exceptions`); never store
22
+ secrets in code or config; never execute unvalidated SQL.
23
+ - Dependencies are added in the milestone that first uses them — don't pull in the whole
24
+ stack early.
25
+
26
+ ## Before opening a pull request
27
+
28
+ ```bash
29
+ ruff check src tests
30
+ ruff format --check src tests
31
+ mypy src
32
+ pytest -q
33
+ ```
34
+
35
+ Please keep changes commit-sized and scoped to a single concern, and update the README when
36
+ you add or change a command.
37
+
38
+ ## Security-sensitive changes
39
+
40
+ Anything touching connection handling, SQL validation, logging/redaction, or credential
41
+ resolution deserves extra care and explicit tests. See [SECURITY.md](SECURITY.md).
insyte-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
insyte-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,363 @@
1
+ Metadata-Version: 2.4
2
+ Name: insyte
3
+ Version: 0.1.0
4
+ Summary: Local-first AI analytics over your database, safely.
5
+ Project-URL: Homepage, https://github.com/insyte-ai/insyte
6
+ Project-URL: Repository, https://github.com/insyte-ai/insyte
7
+ Project-URL: Issues, https://github.com/insyte-ai/insyte/issues
8
+ Author: Insyte contributors
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to Licensor for inclusion in the Work by the copyright owner
60
+ or by an individual or Legal Entity authorized to submit on behalf of
61
+ the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or Derivative
103
+ Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ APPENDIX: How to apply the Apache License to your work.
187
+
188
+ To apply the Apache License to your work, attach the following
189
+ boilerplate notice, with the fields enclosed by brackets "[]"
190
+ replaced with your own identifying information. (Don't include
191
+ the brackets!) The text should be enclosed in the appropriate
192
+ comment syntax for the file format. We also recommend that a
193
+ file or class name and description of purpose be included on the
194
+ same "printed page" as the copyright notice for easier
195
+ identification within third-party archives.
196
+
197
+ Copyright [yyyy] [name of copyright owner]
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+ License-File: LICENSE
211
+ Keywords: ai,analytics,cli,database,duckdb,mcp,postgresql,sql
212
+ Classifier: Development Status :: 3 - Alpha
213
+ Classifier: Environment :: Console
214
+ Classifier: Intended Audience :: Developers
215
+ Classifier: License :: OSI Approved :: Apache Software License
216
+ Classifier: Operating System :: OS Independent
217
+ Classifier: Programming Language :: Python :: 3
218
+ Classifier: Programming Language :: Python :: 3.11
219
+ Classifier: Programming Language :: Python :: 3.12
220
+ Classifier: Topic :: Database
221
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
222
+ Classifier: Typing :: Typed
223
+ Requires-Python: >=3.11
224
+ Requires-Dist: duckdb-engine>=0.13
225
+ Requires-Dist: duckdb>=1.0
226
+ Requires-Dist: fastapi>=0.110
227
+ Requires-Dist: mcp>=1.2
228
+ Requires-Dist: plotext>=5.2
229
+ Requires-Dist: polars>=1.0
230
+ Requires-Dist: psycopg[binary]>=3.1
231
+ Requires-Dist: pyarrow>=16.0
232
+ Requires-Dist: pydantic-settings>=2.3
233
+ Requires-Dist: pydantic>=2.7
234
+ Requires-Dist: pyyaml>=6.0
235
+ Requires-Dist: rich>=13.7
236
+ Requires-Dist: sqlalchemy>=2.0
237
+ Requires-Dist: sqlglot>=25.0
238
+ Requires-Dist: textual>=0.60
239
+ Requires-Dist: tomli-w>=1.0
240
+ Requires-Dist: typer>=0.12
241
+ Requires-Dist: uvicorn>=0.29
242
+ Provides-Extra: dev
243
+ Requires-Dist: httpx>=0.27; extra == 'dev'
244
+ Requires-Dist: mypy>=1.10; extra == 'dev'
245
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
246
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
247
+ Requires-Dist: pytest>=8.2; extra == 'dev'
248
+ Requires-Dist: ruff>=0.5; extra == 'dev'
249
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
250
+ Description-Content-Type: text/markdown
251
+
252
+ # Insyte
253
+
254
+ **Ask your database questions in plain English — locally, and safely.**
255
+
256
+ Insyte connects to your database with **read-only** credentials and turns natural-language
257
+ questions into safe analytics. Ask *"what were total sales last month?"* or *"revenue by
258
+ city"* from a browser workspace, a terminal UI, or your own AI tool (Claude Code / Codex) —
259
+ Insyte writes the SQL, runs it read-only, and shows the answer.
260
+
261
+ Two things are always true:
262
+
263
+ 1. **AI models never see your database credentials.**
264
+ 2. **Nothing can bypass Insyte's SQL validation, row limits, PII masking, or audit log** — a
265
+ dangerous query is rejected, not executed.
266
+
267
+ ## What you can do
268
+
269
+ - **Ask in plain English** — "total order value last month", "orders by payment method",
270
+ "monthly revenue trend", "what's the expected revenue this year?"
271
+ - **Three ways to use it** — a browser workspace (`insyte studio`), a terminal UI
272
+ (`insyte chat`), or directly from **Claude Code / Codex** over MCP.
273
+ - **Trends, breakdowns, comparisons, and forecasts** over metrics Insyte generates from your
274
+ schema — with charts, tables, and the exact SQL on demand.
275
+ - **Read-only and private** — everything runs on your machine against your database; the raw
276
+ connection URL never leaves your computer.
277
+
278
+ ## Install & set up
279
+
280
+ Easiest — **pipx** installs Insyte in its own isolated environment (no virtual-env to manage):
281
+
282
+ ```bash
283
+ pipx install insyte
284
+ insyte init # asks for your read-only DB URL and which AI tool, then sets everything up
285
+ ```
286
+
287
+ <sub>No pipx yet? `brew install pipx` (macOS) or `python -m pip install --user pipx && pipx ensurepath`, then reopen your terminal.</sub>
288
+
289
+ Prefer plain pip? Install into a virtual environment:
290
+
291
+ ```bash
292
+ python -m venv .venv && source .venv/bin/activate
293
+ pip install insyte
294
+ insyte init
295
+ ```
296
+
297
+ `insyte init` walks you through it:
298
+
299
+ 1. Enter your **read-only database URL** (stored once in a `0600` file — never in config,
300
+ never logged, never sent to an AI).
301
+ 2. Pick your **AI tool** — Claude Code, Codex, or none.
302
+ 3. Insyte then **connects, scans the schema, generates metrics, and wires up your AI tool** —
303
+ no scripts, no environment variables.
304
+
305
+ Then use it:
306
+
307
+ ```bash
308
+ insyte studio # browser workspace at http://127.0.0.1:3838
309
+ insyte chat # terminal UI
310
+ insyte analyze total_amount --by city
311
+ ```
312
+
313
+ **Requirements:** Python 3.11+, a PostgreSQL database, and — for natural-language questions —
314
+ the `claude` or `codex` CLI (Studio also answers metric questions without one).
315
+
316
+ ### Recommended: a read-only database user
317
+
318
+ Insyte enforces read-only regardless, but a dedicated account is safest:
319
+
320
+ ```sql
321
+ CREATE ROLE insyte_reader LOGIN PASSWORD '…';
322
+ GRANT CONNECT ON DATABASE your_db TO insyte_reader;
323
+ GRANT USAGE ON SCHEMA public TO insyte_reader;
324
+ GRANT SELECT ON ALL TABLES IN SCHEMA public TO insyte_reader;
325
+ ```
326
+
327
+ ## Use it from Claude Code / Codex
328
+
329
+ `insyte init` already installs the Insyte MCP server into your chosen tool. Restart it, then
330
+ ask questions in plain language — Claude/Codex call Insyte's safe tools; it validates, runs
331
+ read-only, masks PII, and audits every query. (Re-run any time with `insyte mcp install claude`
332
+ or `insyte mcp install codex`.)
333
+
334
+ ## Handy commands
335
+
336
+ | Command | What it does |
337
+ |---|---|
338
+ | `insyte init` | Guided setup: DB URL + AI tool → connect, scan, metrics, MCP |
339
+ | `insyte studio` | Browser workspace (localhost only) |
340
+ | `insyte chat` | Terminal UI |
341
+ | `insyte analyze <metric> --by <dimension>` | A single analysis from the CLI |
342
+ | `insyte metrics` | List the metrics Insyte generated |
343
+ | `insyte status` / `insyte doctor` | Project state / health checks |
344
+
345
+ Everything lives under `~/.insyte/projects/<name>/` (config, stored URL, scanned schema,
346
+ metrics). The connection URL is read only when needed and never written to `config.yaml`.
347
+
348
+ ## Feedback
349
+
350
+ Found a bug or have an idea? Please open an issue:
351
+ **https://github.com/insyte-ai/insyte/issues** — feedback is very welcome.
352
+
353
+ ## Contributing
354
+
355
+ ```bash
356
+ uv venv && uv pip install -e '.[dev]'
357
+ uv run ruff check src tests && uv run mypy src && uv run pytest -q
358
+ ```
359
+
360
+ ## Security & license
361
+
362
+ See [SECURITY.md](SECURITY.md) for the read-only posture and how to report a vulnerability.
363
+ Licensed under **Apache-2.0** — see [LICENSE](LICENSE).