provsql-studio 1.0.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 (67) hide show
  1. provsql_studio-1.0.0/LICENSE +21 -0
  2. provsql_studio-1.0.0/PKG-INFO +143 -0
  3. provsql_studio-1.0.0/README.md +98 -0
  4. provsql_studio-1.0.0/provsql_studio/__init__.py +2 -0
  5. provsql_studio-1.0.0/provsql_studio/__main__.py +4 -0
  6. provsql_studio-1.0.0/provsql_studio/app.py +667 -0
  7. provsql_studio-1.0.0/provsql_studio/circuit.py +346 -0
  8. provsql_studio-1.0.0/provsql_studio/cli.py +232 -0
  9. provsql_studio-1.0.0/provsql_studio/db.py +1657 -0
  10. provsql_studio-1.0.0/provsql_studio/static/app.css +2008 -0
  11. provsql_studio-1.0.0/provsql_studio/static/app.js +2068 -0
  12. provsql_studio-1.0.0/provsql_studio/static/circuit.js +1741 -0
  13. provsql_studio-1.0.0/provsql_studio/static/colors_and_type.css +174 -0
  14. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-Italic-greek-ext.woff2 +0 -0
  15. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-Italic-greek.woff2 +0 -0
  16. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-Italic-latin-ext.woff2 +0 -0
  17. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-Italic-latin.woff2 +0 -0
  18. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-greek-ext.woff2 +0 -0
  19. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-greek.woff2 +0 -0
  20. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-latin-ext.woff2 +0 -0
  21. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-400-latin.woff2 +0 -0
  22. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-Italic-greek-ext.woff2 +0 -0
  23. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-Italic-greek.woff2 +0 -0
  24. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-Italic-latin-ext.woff2 +0 -0
  25. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-Italic-latin.woff2 +0 -0
  26. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-greek-ext.woff2 +0 -0
  27. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-greek.woff2 +0 -0
  28. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-latin-ext.woff2 +0 -0
  29. provsql_studio-1.0.0/provsql_studio/static/fonts/EBGaramond-600-latin.woff2 +0 -0
  30. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-400-greek-ext.woff2 +0 -0
  31. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-400-greek.woff2 +0 -0
  32. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-400-latin-ext.woff2 +0 -0
  33. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-400-latin.woff2 +0 -0
  34. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-400-symbols2.woff2 +0 -0
  35. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-500-greek-ext.woff2 +0 -0
  36. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-500-greek.woff2 +0 -0
  37. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-500-latin-ext.woff2 +0 -0
  38. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-500-latin.woff2 +0 -0
  39. provsql_studio-1.0.0/provsql_studio/static/fonts/FiraCode-500-symbols2.woff2 +0 -0
  40. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-400-latin-ext.woff2 +0 -0
  41. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-400-latin.woff2 +0 -0
  42. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-500-latin-ext.woff2 +0 -0
  43. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-500-latin.woff2 +0 -0
  44. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-600-latin-ext.woff2 +0 -0
  45. provsql_studio-1.0.0/provsql_studio/static/fonts/Jost-600-latin.woff2 +0 -0
  46. provsql_studio-1.0.0/provsql_studio/static/fonts/OFL-EBGaramond.txt +94 -0
  47. provsql_studio-1.0.0/provsql_studio/static/fonts/OFL-FiraCode.txt +93 -0
  48. provsql_studio-1.0.0/provsql_studio/static/fonts/OFL-Jost.txt +83 -0
  49. provsql_studio-1.0.0/provsql_studio/static/fonts-face.css +198 -0
  50. provsql_studio-1.0.0/provsql_studio/static/img/favicon.ico +0 -0
  51. provsql_studio-1.0.0/provsql_studio/static/img/logo.png +0 -0
  52. provsql_studio-1.0.0/provsql_studio/static/index.html +303 -0
  53. provsql_studio-1.0.0/provsql_studio.egg-info/PKG-INFO +143 -0
  54. provsql_studio-1.0.0/provsql_studio.egg-info/SOURCES.txt +65 -0
  55. provsql_studio-1.0.0/provsql_studio.egg-info/dependency_links.txt +1 -0
  56. provsql_studio-1.0.0/provsql_studio.egg-info/entry_points.txt +2 -0
  57. provsql_studio-1.0.0/provsql_studio.egg-info/requires.txt +15 -0
  58. provsql_studio-1.0.0/provsql_studio.egg-info/top_level.txt +1 -0
  59. provsql_studio-1.0.0/pyproject.toml +72 -0
  60. provsql_studio-1.0.0/setup.cfg +4 -0
  61. provsql_studio-1.0.0/tests/test_circuit.py +296 -0
  62. provsql_studio-1.0.0/tests/test_cli.py +94 -0
  63. provsql_studio-1.0.0/tests/test_config.py +288 -0
  64. provsql_studio-1.0.0/tests/test_conn.py +74 -0
  65. provsql_studio-1.0.0/tests/test_evaluate.py +747 -0
  66. provsql_studio-1.0.0/tests/test_exec.py +390 -0
  67. provsql_studio-1.0.0/tests/test_relations.py +205 -0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Pierre Senellart
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: provsql-studio
3
+ Version: 1.0.0
4
+ Summary: Web UI for ProvSQL: provenance inspection, circuit visualisation, and on-the-fly semiring evaluation.
5
+ Author-email: Pierre Senellart <pierre@senellart.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://provsql.org
8
+ Project-URL: Documentation, https://provsql.org/docs/user/studio.html
9
+ Project-URL: Source, https://github.com/PierreSenellart/provsql
10
+ Project-URL: Issues, https://github.com/PierreSenellart/provsql/issues
11
+ Project-URL: Changelog, https://github.com/PierreSenellart/provsql/releases?q=tag%3Astudio-v
12
+ Keywords: postgresql,probabilistic-database,provenance,provenance-tracking,provsql,web-ui
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Flask
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Database
26
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
27
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: flask>=3.0
32
+ Requires-Dist: platformdirs>=4.0
33
+ Requires-Dist: psycopg[binary]>=3.1
34
+ Requires-Dist: psycopg-pool>=3.2
35
+ Requires-Dist: sqlparse>=0.4
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest>=7; extra == "test"
38
+ Requires-Dist: pytest-flask>=1.3; extra == "test"
39
+ Requires-Dist: playwright>=1.40; extra == "test"
40
+ Requires-Dist: pytest-playwright>=0.4; extra == "test"
41
+ Provides-Extra: dev
42
+ Requires-Dist: ruff>=0.5; extra == "dev"
43
+ Requires-Dist: mypy>=1.8; extra == "dev"
44
+ Dynamic: license-file
45
+
46
+ # ProvSQL Studio
47
+
48
+ [![CI](https://github.com/PierreSenellart/provsql/actions/workflows/studio.yml/badge.svg?branch=master)](https://github.com/PierreSenellart/provsql/actions/workflows/studio.yml)
49
+ [![PyPI](https://img.shields.io/pypi/v/provsql-studio?style=flat)](https://pypi.org/project/provsql-studio/)
50
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
51
+
52
+ Web UI for [ProvSQL](https://provsql.org/): provenance inspection, circuit
53
+ visualisation, and on-the-fly semiring evaluation.
54
+
55
+ ProvSQL is a PostgreSQL extension that adds (m-)semiring provenance and
56
+ uncertainty management to PostgreSQL, transparently rewriting queries to
57
+ track provenance as circuit tokens. ProvSQL Studio is a small Flask app
58
+ that lets you point a browser at a ProvSQL-enabled database and inspect
59
+ that provenance interactively, without writing the query-wrapping
60
+ boilerplate by hand.
61
+
62
+ Website: **<https://provsql.org/>** – Documentation: **<https://provsql.org/docs/user/studio.html>**
63
+
64
+ ## Inspection modes
65
+
66
+ Two complementary modes share the same UI (query box, result table,
67
+ sidebar):
68
+
69
+ * **Where mode** highlights the source cells that contributed to each
70
+ output value. Hover a result cell and the contributing cells of the
71
+ underlying provenance-tracked relations light up in the sidebar. The
72
+ query is wrapped automatically with `provsql.where_provenance`, so no
73
+ explicit `where_provenance(...)` call is needed.
74
+
75
+ * **Circuit mode** renders the provenance DAG behind a result's UUID
76
+ or aggregate token. Click a UUID cell to load its DAG, hover to
77
+ highlight a subtree, click to pin a node and open the inspector.
78
+ Frontiers expand on demand so deep circuits stay readable. An
79
+ evaluation strip targets the pinned node (or the root) and runs
80
+ provenance evaluation in various semirings, probability computation
81
+ through various methods, or PROV-XML export, with the result
82
+ rendered inline.
83
+
84
+ A schema panel and a configuration panel round out the UI; see the
85
+ documentation for the full feature reference.
86
+
87
+ ## Install
88
+
89
+ ```sh
90
+ pip install provsql-studio
91
+ ```
92
+
93
+ Requires Python 3.10+ and a PostgreSQL database with the ProvSQL
94
+ extension installed (see the
95
+ [extension installation guide](https://provsql.org/docs/user/getting-provsql.html)).
96
+ Studio 1.0.x targets ProvSQL extension 1.4.0 or newer; the startup
97
+ check refuses to launch against an older extension unless
98
+ `--ignore-version` is passed.
99
+
100
+ ## Connecting
101
+
102
+ Launch Studio with a DSN:
103
+
104
+ ```sh
105
+ provsql-studio --dsn postgresql://user@localhost:5432/mydb
106
+ ```
107
+
108
+ Without `--dsn`, libpq's standard environment variables (`PGDATABASE`,
109
+ `PGSERVICE`, `DATABASE_URL`…) are honoured. If neither is set,
110
+ Studio connects to the `postgres` maintenance database and offers an
111
+ in-page database picker.
112
+
113
+ The browser reaches the UI at `http://127.0.0.1:8000/`. Override the
114
+ bind address and port with `--host` and `--port`. Per-request size
115
+ caps, statement timeout, and search path are tunable on the CLI
116
+ (`--max-circuit-nodes`, `--max-sidebar-rows`, `--max-result-rows`,
117
+ `--statement-timeout`, `--search-path`) and through the Config panel;
118
+ the panel persists its settings to
119
+ `~/.config/provsql-studio/config.json`.
120
+
121
+ ## Documentation
122
+
123
+ The full Studio user guide, including screenshots, the configuration
124
+ reference, the compatibility matrix, and worked examples, lives at:
125
+
126
+ <https://provsql.org/docs/user/studio.html>
127
+
128
+ For the underlying ProvSQL SQL API (`add_provenance`,
129
+ `create_provenance_mapping`, `view_circuit`, `provenance_evaluate`,
130
+ and the rest), see <https://provsql.org/docs/>.
131
+
132
+ ## License
133
+
134
+ MIT: see [LICENSE](LICENSE).
135
+
136
+ ## Contact
137
+
138
+ <https://github.com/PierreSenellart/provsql>
139
+
140
+ Pierre Senellart <pierre@senellart.com>
141
+
142
+ Bug reports and feature requests are preferably sent through the
143
+ *Issues* feature of GitHub.
@@ -0,0 +1,98 @@
1
+ # ProvSQL Studio
2
+
3
+ [![CI](https://github.com/PierreSenellart/provsql/actions/workflows/studio.yml/badge.svg?branch=master)](https://github.com/PierreSenellart/provsql/actions/workflows/studio.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/provsql-studio?style=flat)](https://pypi.org/project/provsql-studio/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ Web UI for [ProvSQL](https://provsql.org/): provenance inspection, circuit
8
+ visualisation, and on-the-fly semiring evaluation.
9
+
10
+ ProvSQL is a PostgreSQL extension that adds (m-)semiring provenance and
11
+ uncertainty management to PostgreSQL, transparently rewriting queries to
12
+ track provenance as circuit tokens. ProvSQL Studio is a small Flask app
13
+ that lets you point a browser at a ProvSQL-enabled database and inspect
14
+ that provenance interactively, without writing the query-wrapping
15
+ boilerplate by hand.
16
+
17
+ Website: **<https://provsql.org/>** – Documentation: **<https://provsql.org/docs/user/studio.html>**
18
+
19
+ ## Inspection modes
20
+
21
+ Two complementary modes share the same UI (query box, result table,
22
+ sidebar):
23
+
24
+ * **Where mode** highlights the source cells that contributed to each
25
+ output value. Hover a result cell and the contributing cells of the
26
+ underlying provenance-tracked relations light up in the sidebar. The
27
+ query is wrapped automatically with `provsql.where_provenance`, so no
28
+ explicit `where_provenance(...)` call is needed.
29
+
30
+ * **Circuit mode** renders the provenance DAG behind a result's UUID
31
+ or aggregate token. Click a UUID cell to load its DAG, hover to
32
+ highlight a subtree, click to pin a node and open the inspector.
33
+ Frontiers expand on demand so deep circuits stay readable. An
34
+ evaluation strip targets the pinned node (or the root) and runs
35
+ provenance evaluation in various semirings, probability computation
36
+ through various methods, or PROV-XML export, with the result
37
+ rendered inline.
38
+
39
+ A schema panel and a configuration panel round out the UI; see the
40
+ documentation for the full feature reference.
41
+
42
+ ## Install
43
+
44
+ ```sh
45
+ pip install provsql-studio
46
+ ```
47
+
48
+ Requires Python 3.10+ and a PostgreSQL database with the ProvSQL
49
+ extension installed (see the
50
+ [extension installation guide](https://provsql.org/docs/user/getting-provsql.html)).
51
+ Studio 1.0.x targets ProvSQL extension 1.4.0 or newer; the startup
52
+ check refuses to launch against an older extension unless
53
+ `--ignore-version` is passed.
54
+
55
+ ## Connecting
56
+
57
+ Launch Studio with a DSN:
58
+
59
+ ```sh
60
+ provsql-studio --dsn postgresql://user@localhost:5432/mydb
61
+ ```
62
+
63
+ Without `--dsn`, libpq's standard environment variables (`PGDATABASE`,
64
+ `PGSERVICE`, `DATABASE_URL`…) are honoured. If neither is set,
65
+ Studio connects to the `postgres` maintenance database and offers an
66
+ in-page database picker.
67
+
68
+ The browser reaches the UI at `http://127.0.0.1:8000/`. Override the
69
+ bind address and port with `--host` and `--port`. Per-request size
70
+ caps, statement timeout, and search path are tunable on the CLI
71
+ (`--max-circuit-nodes`, `--max-sidebar-rows`, `--max-result-rows`,
72
+ `--statement-timeout`, `--search-path`) and through the Config panel;
73
+ the panel persists its settings to
74
+ `~/.config/provsql-studio/config.json`.
75
+
76
+ ## Documentation
77
+
78
+ The full Studio user guide, including screenshots, the configuration
79
+ reference, the compatibility matrix, and worked examples, lives at:
80
+
81
+ <https://provsql.org/docs/user/studio.html>
82
+
83
+ For the underlying ProvSQL SQL API (`add_provenance`,
84
+ `create_provenance_mapping`, `view_circuit`, `provenance_evaluate`,
85
+ and the rest), see <https://provsql.org/docs/>.
86
+
87
+ ## License
88
+
89
+ MIT: see [LICENSE](LICENSE).
90
+
91
+ ## Contact
92
+
93
+ <https://github.com/PierreSenellart/provsql>
94
+
95
+ Pierre Senellart <pierre@senellart.com>
96
+
97
+ Bug reports and feature requests are preferably sent through the
98
+ *Issues* feature of GitHub.
@@ -0,0 +1,2 @@
1
+ """ProvSQL Studio: web UI for the ProvSQL PostgreSQL extension."""
2
+ __version__ = "1.0.0"
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()