zaturn 0.1.2__tar.gz → 0.1.4__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.
@@ -10,5 +10,5 @@ wheels/
10
10
  .venv
11
11
 
12
12
  # Project Related
13
- sample_dbs/
14
- localtests.py
13
+ debug.py
14
+ todo.md
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zaturn
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: AI Data Analysis MCP
5
5
  Author-email: Karthik Devan <krtdvn@gmail.com>
6
6
  Maintainer-email: Karthik Devan <krtdvn@gmail.com>
7
7
  Project-URL: Homepage, https://github.com/kdqed/zaturn
8
8
  Project-URL: Issues, https://github.com/kdqed/zaturn/issues
9
- Project-URL: CI, https://github.com/kdqed/zaturn/actions
10
9
  Requires-Python: >=3.11
11
10
  Description-Content-Type: text/markdown
12
11
  License-File: LICENSE
@@ -25,15 +24,31 @@ Requires-Dist: sqlalchemy>=2.0.40
25
24
  Requires-Dist: tabulate>=0.9.0
26
25
  Dynamic: license-file
27
26
 
28
- <p align="center">
29
- <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="128" height="128">
30
- </p>
27
+ <h1>
28
+ <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="24" height="24">
29
+ <span>Zaturn: Your Co-Pilot For Data Analytics & Business Insights</span>
30
+ </h1>
31
31
 
32
- # Zaturn: Your Co-Pilot For Data Analytics & BI
32
+ Zaturn let's you analyze your data using AI chat; without needing you to write SQL/Python code or fiddling with aesthetically pleasing (but overwhelming) dashboards.
33
+
34
+ You can add Zaturn MCP to Claude Desktop (or any MCP client), connect your data sources, ask questions in natural language, and get instant insights with visualizations. With Zaturn, your AI can automatically understand the kind of data you have, query it, and give you useful pointers with a coherent narrative. You can ask specific questions like "Who is our most valuable customer?", or let AI explore your data with a question like "Here's all the data we have, give us some ideas for the next quarter."
35
+
36
+ [![PyPI Downloads](https://static.pepy.tech/badge/zaturn)](https://pepy.tech/projects/zaturn)
37
+
38
+ [Join The Discord](https://discord.gg/K8mECeVzpQ)
33
39
 
34
- https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
35
40
 
36
- Zaturn is an open source, AI-powered data analysis/BI tool that can connect to your data sources, run SQL queries on it, and give you useful insights. Think of it like vibe data analysis, in the spirit of vibe coding. Currently Zaturn is available as an MCP (Model Context Protocol) Server that can be integrated into your favorite MCP Client (Claude, Cursor, etc.) A full fledged notebook interface is on the roadmap.
41
+ <a href="https://glama.ai/mcp/servers/@kdqed/zaturn">
42
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@kdqed/zaturn/badge" alt="Zaturn MCP server" />
43
+ </a>
44
+
45
+ ## But I can just upload my data to ChatGPT and ask it to analyze right?
46
+
47
+ Yes, but ChatGPT has an upload size limit of approximately 50MB for CSV files/spreadsheets, and uploading also takes time. Plus, it can't read data straight from your MySQL or PostgreSQL server. Zaturn can overcome all of these limitations, without moving your data anywhere. It simply equips your AI with SQL and visualization capabilities so AI can query your data directly, get the results, process them, and give you instant insights. With Zaturn, AI does not need to process your full dataset and keep it in its memory to answer your questions about the data.
48
+
49
+ ## Zaturn in Action
50
+
51
+ https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
37
52
 
38
53
  ## Features:
39
54
 
@@ -59,12 +74,6 @@ In addition to providing tabular and textual summaries, Zaturn can also generate
59
74
  More visualization capabilities are being added.
60
75
 
61
76
 
62
- ## How Does Zaturn Work?
63
-
64
- The naivest way to have an LLM analyze your data is to upload a dataset with a prompt. But that won't get you far, because AI has context window limitations, and it can only go through a few thousand rows at the best. Also, LLM's are not great at doing math.
65
-
66
- Using an MCP like Zaturn will keep your data where it is, and enable AI to draft and run SQL queries on the data. The LLM now processes only the queries and results instead of your entire dataset.
67
-
68
77
  ## Installation & Setup
69
78
  1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)
70
79
 
@@ -149,9 +158,15 @@ Analyst:
149
158
  ```
150
159
  - A native notebook interface
151
160
 
152
- If you have any specific requirements please feel free to raise an issue.
161
+ ## Support And Feedback
162
+
163
+ [Raise an issue](https://github.com/kdqed/zaturn/issues) or [join the Discord](https://discord.gg/K8mECeVzpQ).
153
164
 
154
165
 
155
166
  ## Example Dataset Credits
156
167
 
157
168
  The [pokemon dataset compiled by Sarah Taha and PokéAPI](https://www.kaggle.com/datasets/sarahtaha/1025-pokemon) has been included under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license for demonstration purposes.
169
+
170
+ ## Star History
171
+
172
+ [![Star History Chart](https://api.star-history.com/svg?repos=kdqed/zaturn&type=Date)](https://www.star-history.com/#kdqed/zaturn&Date)
@@ -1,12 +1,28 @@
1
- <p align="center">
2
- <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="128" height="128">
3
- </p>
1
+ <h1>
2
+ <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="24" height="24">
3
+ <span>Zaturn: Your Co-Pilot For Data Analytics & Business Insights</span>
4
+ </h1>
4
5
 
5
- # Zaturn: Your Co-Pilot For Data Analytics & BI
6
+ Zaturn let's you analyze your data using AI chat; without needing you to write SQL/Python code or fiddling with aesthetically pleasing (but overwhelming) dashboards.
7
+
8
+ You can add Zaturn MCP to Claude Desktop (or any MCP client), connect your data sources, ask questions in natural language, and get instant insights with visualizations. With Zaturn, your AI can automatically understand the kind of data you have, query it, and give you useful pointers with a coherent narrative. You can ask specific questions like "Who is our most valuable customer?", or let AI explore your data with a question like "Here's all the data we have, give us some ideas for the next quarter."
9
+
10
+ [![PyPI Downloads](https://static.pepy.tech/badge/zaturn)](https://pepy.tech/projects/zaturn)
11
+
12
+ [Join The Discord](https://discord.gg/K8mECeVzpQ)
6
13
 
7
- https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
8
14
 
9
- Zaturn is an open source, AI-powered data analysis/BI tool that can connect to your data sources, run SQL queries on it, and give you useful insights. Think of it like vibe data analysis, in the spirit of vibe coding. Currently Zaturn is available as an MCP (Model Context Protocol) Server that can be integrated into your favorite MCP Client (Claude, Cursor, etc.) A full fledged notebook interface is on the roadmap.
15
+ <a href="https://glama.ai/mcp/servers/@kdqed/zaturn">
16
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@kdqed/zaturn/badge" alt="Zaturn MCP server" />
17
+ </a>
18
+
19
+ ## But I can just upload my data to ChatGPT and ask it to analyze right?
20
+
21
+ Yes, but ChatGPT has an upload size limit of approximately 50MB for CSV files/spreadsheets, and uploading also takes time. Plus, it can't read data straight from your MySQL or PostgreSQL server. Zaturn can overcome all of these limitations, without moving your data anywhere. It simply equips your AI with SQL and visualization capabilities so AI can query your data directly, get the results, process them, and give you instant insights. With Zaturn, AI does not need to process your full dataset and keep it in its memory to answer your questions about the data.
22
+
23
+ ## Zaturn in Action
24
+
25
+ https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
10
26
 
11
27
  ## Features:
12
28
 
@@ -32,12 +48,6 @@ In addition to providing tabular and textual summaries, Zaturn can also generate
32
48
  More visualization capabilities are being added.
33
49
 
34
50
 
35
- ## How Does Zaturn Work?
36
-
37
- The naivest way to have an LLM analyze your data is to upload a dataset with a prompt. But that won't get you far, because AI has context window limitations, and it can only go through a few thousand rows at the best. Also, LLM's are not great at doing math.
38
-
39
- Using an MCP like Zaturn will keep your data where it is, and enable AI to draft and run SQL queries on the data. The LLM now processes only the queries and results instead of your entire dataset.
40
-
41
51
  ## Installation & Setup
42
52
  1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)
43
53
 
@@ -122,9 +132,15 @@ Analyst:
122
132
  ```
123
133
  - A native notebook interface
124
134
 
125
- If you have any specific requirements please feel free to raise an issue.
135
+ ## Support And Feedback
136
+
137
+ [Raise an issue](https://github.com/kdqed/zaturn/issues) or [join the Discord](https://discord.gg/K8mECeVzpQ).
126
138
 
127
139
 
128
140
  ## Example Dataset Credits
129
141
 
130
142
  The [pokemon dataset compiled by Sarah Taha and PokéAPI](https://www.kaggle.com/datasets/sarahtaha/1025-pokemon) has been included under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license for demonstration purposes.
143
+
144
+ ## Star History
145
+
146
+ [![Star History Chart](https://api.star-history.com/svg?repos=kdqed/zaturn&type=Date)](https://www.star-history.com/#kdqed/zaturn&Date)
@@ -0,0 +1,4 @@
1
+ from zaturn import mcp
2
+
3
+ if __name__=="__main__":
4
+ mcp.run(transport='sse')
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "zaturn"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "AI Data Analysis MCP"
5
5
  authors = [
6
6
  {name = "Karthik Devan", email = "krtdvn@gmail.com"},
@@ -32,7 +32,6 @@ zaturn_mcp = "zaturn:main"
32
32
  [project.urls]
33
33
  Homepage = "https://github.com/kdqed/zaturn"
34
34
  Issues = "https://github.com/kdqed/zaturn/issues"
35
- CI = "https://github.com/kdqed/zaturn/actions"
36
35
 
37
36
  [build-system]
38
37
  requires = [
@@ -45,7 +44,7 @@ build-backend = "setuptools.build_meta"
45
44
  include-package-data = false
46
45
 
47
46
  [tool.setuptools.packages.find]
48
- exclude = ["docs*", "brand*"]
47
+ exclude = ["docs*", "brand*", "debug*"]
49
48
  include = ["zaturn*"]
50
49
 
51
50
  [tool.setuptools.package-data]
@@ -1329,7 +1329,7 @@ wheels = [
1329
1329
 
1330
1330
  [[package]]
1331
1331
  name = "zaturn"
1332
- version = "0.1.0"
1332
+ version = "0.1.3"
1333
1333
  source = { editable = "." }
1334
1334
  dependencies = [
1335
1335
  { name = "cryptography" },
@@ -20,15 +20,17 @@ def list_sources() -> str:
20
20
 
21
21
  result = "Available data sources:\n\n"
22
22
  for source in config.SOURCES:
23
- result += f"- {source}\n"
23
+ tables = _list_tables(source)
24
+ if type(tables) is List:
25
+ tables = ', '.join(tables)
26
+ result += f"- {source}\nHas tables: {tables}\n"
24
27
 
25
28
  return result
26
29
  except Exception as e:
27
30
  return str(e)
28
31
 
29
32
 
30
- @mcp.tool()
31
- def list_tables(source_id: str):
33
+ def _list_tables(source_id: str):
32
34
  """
33
35
  Lists names of all tables/datasets in a given data source.
34
36
  Use run_query with appropriate SQL query to determine table structure
@@ -67,6 +69,43 @@ def list_tables(source_id: str):
67
69
  except Exception as e:
68
70
  return str(e)
69
71
 
72
+ @mcp.tool()
73
+ def describe_table(source_id: str, table_name: str) -> str:
74
+ """
75
+ Lists columns and their types in the specified table of specified data source.
76
+
77
+ Args:
78
+ source_id: The data source
79
+ table_name: The table in the data source
80
+ """
81
+ try:
82
+ source = config.SOURCES.get(source_id)
83
+ if not source:
84
+ return f"Source {source_id} Not Found"
85
+
86
+ match source['type']:
87
+ case 'sqlite':
88
+ result = query_utils.execute_query(source,
89
+ f"PRAGMA table_info({table_name});"
90
+ )
91
+ return result.to_markdown(index=False)
92
+
93
+ case 'postgresql':
94
+ result = query_utils.execute_query(source,
95
+ f"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{table_name}';"
96
+ )
97
+ return result.to_markdown(index=False)
98
+
99
+ case "mysql" | "duckdb" | "csv" | "parquet":
100
+ result = query_utils.execute_query(source,
101
+ f"DESCRIBE {table_name};"
102
+ )
103
+ return result.to_markdown(index=False)
104
+
105
+ except Exception as e:
106
+ return str(e)
107
+
108
+
70
109
  @mcp.tool()
71
110
  def run_query(source_id: str, query: str) -> str:
72
111
  """
@@ -1,4 +1,5 @@
1
1
  from fastmcp import FastMCP, Image
2
+ import math
2
3
  import matplotlib.pyplot as plt
3
4
  import os
4
5
  import seaborn as sns
@@ -7,6 +8,7 @@ from typing import Any, Union, Optional
7
8
  from zaturn import config, query_utils
8
9
 
9
10
  sns.set_theme()
11
+ sns.set_style('ticks')
10
12
 
11
13
  mcp = FastMCP("Zaturn Visualizations")
12
14
 
@@ -14,7 +16,7 @@ mcp = FastMCP("Zaturn Visualizations")
14
16
  def _plot_to_image(plot) -> Union[str, Image]:
15
17
  figure = plot.get_figure()
16
18
  filepath = os.path.join(config.VISUALS_DIR, str(int(time.time())) + '.png')
17
- figure.savefig(filepath)
19
+ figure.savefig(filepath, bbox_inches='tight')
18
20
  plt.clf()
19
21
  if config.RETURN_IMAGES:
20
22
  return Image(path=filepath)
@@ -22,6 +24,47 @@ def _plot_to_image(plot) -> Union[str, Image]:
22
24
  return filepath
23
25
 
24
26
 
27
+ def _fix_x_labels(plot, labels):
28
+ max_label_length = max(list(labels.map(lambda x: len(str(x)))))
29
+
30
+ LABEL_HIDE_FACTOR = 1
31
+ if len(labels) > 20:
32
+ LABEL_HIDE_FACTOR = math.ceil(len(labels)/20)
33
+
34
+ labels_to_show = list(labels)
35
+ ticks = list(plot.get_xticks())
36
+ if LABEL_HIDE_FACTOR > 1:
37
+ ticks = ticks[::LABEL_HIDE_FACTOR]
38
+ labels_to_show = labels_to_show[::LABEL_HIDE_FACTOR]
39
+
40
+ plot.set_xticks(ticks, labels_to_show)
41
+ cutoff = 2 # for rotation
42
+
43
+ if max_label_length >= 12:
44
+ cutoff = 3
45
+ elif max_label_length >= 10:
46
+ cutoff = 4
47
+ elif max_label_length >= 8:
48
+ cutoff = 5
49
+ elif max_label_length >= 7:
50
+ cutoff = 5
51
+ elif max_label_length >= 6:
52
+ cutoff = 6
53
+ elif max_label_length >= 5:
54
+ cutoff = 7
55
+ elif max_label_length >= 4:
56
+ cutoff = 9
57
+ elif max_label_length >= 3:
58
+ cutoff = 13
59
+ else:
60
+ cutoff = 15
61
+
62
+ if len(labels)>cutoff:
63
+ plot.set_xticklabels(plot.get_xticklabels(), rotation=-45, ha='left', va='top')
64
+
65
+ return plot
66
+
67
+
25
68
  # Relationships
26
69
 
27
70
  @mcp.tool()
@@ -42,6 +85,7 @@ def scatter_plot(
42
85
  """
43
86
  df = query_utils.load_query(query_id)
44
87
  plot = sns.scatterplot(df, x=x, y=y, hue=hue)
88
+ plot = _fix_x_labels(plot, df[x])
45
89
  return _plot_to_image(plot)
46
90
 
47
91
 
@@ -62,6 +106,7 @@ def line_plot(
62
106
  """
63
107
  df = query_utils.load_query(query_id)
64
108
  plot = sns.lineplot(df, x=x, y=y, hue=hue)
109
+ plot = _fix_x_labels(plot, df[x])
65
110
  return _plot_to_image(plot)
66
111
 
67
112
 
@@ -108,6 +153,7 @@ def strip_plot(
108
153
  """
109
154
  df = query_utils.load_query(query_id)
110
155
  plot = sns.stripplot(df, x=x, y=y, hue=hue, legend=legend)
156
+ plot = _fix_x_labels(plot, df[x])
111
157
  return _plot_to_image(plot)
112
158
 
113
159
 
@@ -128,6 +174,7 @@ def box_plot(
128
174
  """
129
175
  df = query_utils.load_query(query_id)
130
176
  plot = sns.boxplot(df, x=x, y=y, hue=hue)
177
+ plot = _fix_x_labels(plot, df[x])
131
178
  return _plot_to_image(plot)
132
179
 
133
180
 
@@ -150,6 +197,7 @@ def bar_plot(
150
197
  """
151
198
  df = query_utils.load_query(query_id)
152
199
  plot = sns.barplot(df, x=x, y=y, hue=hue, orient=orient)
200
+ plot = _fix_x_labels(plot, df[x])
153
201
  return _plot_to_image(plot)
154
202
 
155
203
 
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zaturn
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: AI Data Analysis MCP
5
5
  Author-email: Karthik Devan <krtdvn@gmail.com>
6
6
  Maintainer-email: Karthik Devan <krtdvn@gmail.com>
7
7
  Project-URL: Homepage, https://github.com/kdqed/zaturn
8
8
  Project-URL: Issues, https://github.com/kdqed/zaturn/issues
9
- Project-URL: CI, https://github.com/kdqed/zaturn/actions
10
9
  Requires-Python: >=3.11
11
10
  Description-Content-Type: text/markdown
12
11
  License-File: LICENSE
@@ -25,15 +24,31 @@ Requires-Dist: sqlalchemy>=2.0.40
25
24
  Requires-Dist: tabulate>=0.9.0
26
25
  Dynamic: license-file
27
26
 
28
- <p align="center">
29
- <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="128" height="128">
30
- </p>
27
+ <h1>
28
+ <img src="https://github.com/kdqed/zaturn/raw/main/brand/logo.png" width="24" height="24">
29
+ <span>Zaturn: Your Co-Pilot For Data Analytics & Business Insights</span>
30
+ </h1>
31
31
 
32
- # Zaturn: Your Co-Pilot For Data Analytics & BI
32
+ Zaturn let's you analyze your data using AI chat; without needing you to write SQL/Python code or fiddling with aesthetically pleasing (but overwhelming) dashboards.
33
+
34
+ You can add Zaturn MCP to Claude Desktop (or any MCP client), connect your data sources, ask questions in natural language, and get instant insights with visualizations. With Zaturn, your AI can automatically understand the kind of data you have, query it, and give you useful pointers with a coherent narrative. You can ask specific questions like "Who is our most valuable customer?", or let AI explore your data with a question like "Here's all the data we have, give us some ideas for the next quarter."
35
+
36
+ [![PyPI Downloads](https://static.pepy.tech/badge/zaturn)](https://pepy.tech/projects/zaturn)
37
+
38
+ [Join The Discord](https://discord.gg/K8mECeVzpQ)
33
39
 
34
- https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
35
40
 
36
- Zaturn is an open source, AI-powered data analysis/BI tool that can connect to your data sources, run SQL queries on it, and give you useful insights. Think of it like vibe data analysis, in the spirit of vibe coding. Currently Zaturn is available as an MCP (Model Context Protocol) Server that can be integrated into your favorite MCP Client (Claude, Cursor, etc.) A full fledged notebook interface is on the roadmap.
41
+ <a href="https://glama.ai/mcp/servers/@kdqed/zaturn">
42
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@kdqed/zaturn/badge" alt="Zaturn MCP server" />
43
+ </a>
44
+
45
+ ## But I can just upload my data to ChatGPT and ask it to analyze right?
46
+
47
+ Yes, but ChatGPT has an upload size limit of approximately 50MB for CSV files/spreadsheets, and uploading also takes time. Plus, it can't read data straight from your MySQL or PostgreSQL server. Zaturn can overcome all of these limitations, without moving your data anywhere. It simply equips your AI with SQL and visualization capabilities so AI can query your data directly, get the results, process them, and give you instant insights. With Zaturn, AI does not need to process your full dataset and keep it in its memory to answer your questions about the data.
48
+
49
+ ## Zaturn in Action
50
+
51
+ https://github.com/user-attachments/assets/d42dc433-e5ec-4b3e-bef0-5cfc097396ab
37
52
 
38
53
  ## Features:
39
54
 
@@ -59,12 +74,6 @@ In addition to providing tabular and textual summaries, Zaturn can also generate
59
74
  More visualization capabilities are being added.
60
75
 
61
76
 
62
- ## How Does Zaturn Work?
63
-
64
- The naivest way to have an LLM analyze your data is to upload a dataset with a prompt. But that won't get you far, because AI has context window limitations, and it can only go through a few thousand rows at the best. Also, LLM's are not great at doing math.
65
-
66
- Using an MCP like Zaturn will keep your data where it is, and enable AI to draft and run SQL queries on the data. The LLM now processes only the queries and results instead of your entire dataset.
67
-
68
77
  ## Installation & Setup
69
78
  1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)
70
79
 
@@ -149,9 +158,15 @@ Analyst:
149
158
  ```
150
159
  - A native notebook interface
151
160
 
152
- If you have any specific requirements please feel free to raise an issue.
161
+ ## Support And Feedback
162
+
163
+ [Raise an issue](https://github.com/kdqed/zaturn/issues) or [join the Discord](https://discord.gg/K8mECeVzpQ).
153
164
 
154
165
 
155
166
  ## Example Dataset Credits
156
167
 
157
168
  The [pokemon dataset compiled by Sarah Taha and PokéAPI](https://www.kaggle.com/datasets/sarahtaha/1025-pokemon) has been included under the [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license for demonstration purposes.
169
+
170
+ ## Star History
171
+
172
+ [![Star History Chart](https://api.star-history.com/svg?repos=kdqed/zaturn&type=Date)](https://www.star-history.com/#kdqed/zaturn&Date)
@@ -1,6 +1,7 @@
1
1
  .gitignore
2
2
  LICENSE
3
3
  README.md
4
+ debug_server.py
4
5
  pyproject.toml
5
6
  uv.lock
6
7
  brand/logo.png
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes