pychartai 0.5.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.
- pychartai-0.5.0/LICENSE +21 -0
- pychartai-0.5.0/PKG-INFO +240 -0
- pychartai-0.5.0/README.md +143 -0
- pychartai-0.5.0/pyproject.toml +149 -0
- pychartai-0.5.0/setup.cfg +4 -0
- pychartai-0.5.0/setup.py +20 -0
- pychartai-0.5.0/src/pychartai/__init__.py +504 -0
- pychartai-0.5.0/src/pychartai/cli.py +91 -0
- pychartai-0.5.0/src/pychartai.egg-info/PKG-INFO +240 -0
- pychartai-0.5.0/src/pychartai.egg-info/SOURCES.txt +76 -0
- pychartai-0.5.0/src/pychartai.egg-info/dependency_links.txt +1 -0
- pychartai-0.5.0/src/pychartai.egg-info/entry_points.txt +4 -0
- pychartai-0.5.0/src/pychartai.egg-info/requires.txt +84 -0
- pychartai-0.5.0/src/pychartai.egg-info/top_level.txt +3 -0
- pychartai-0.5.0/src/pychartai_core/__init__.py +148 -0
- pychartai-0.5.0/src/pychartai_core/agent.py +1248 -0
- pychartai-0.5.0/src/pychartai_core/api.py +189 -0
- pychartai-0.5.0/src/pychartai_core/cache.py +119 -0
- pychartai-0.5.0/src/pychartai_core/cloud_connectors.py +364 -0
- pychartai-0.5.0/src/pychartai_core/code_sanitizer.py +144 -0
- pychartai-0.5.0/src/pychartai_core/config.py +115 -0
- pychartai-0.5.0/src/pychartai_core/connections.py +253 -0
- pychartai-0.5.0/src/pychartai_core/dashboard_report.py +266 -0
- pychartai-0.5.0/src/pychartai_core/data_manager.py +116 -0
- pychartai-0.5.0/src/pychartai_core/db_connectors.py +302 -0
- pychartai-0.5.0/src/pychartai_core/error_hints.py +79 -0
- pychartai-0.5.0/src/pychartai_core/intent_classifier.py +203 -0
- pychartai-0.5.0/src/pychartai_core/io.py +86 -0
- pychartai-0.5.0/src/pychartai_core/logging.py +103 -0
- pychartai-0.5.0/src/pychartai_core/memory.py +134 -0
- pychartai-0.5.0/src/pychartai_core/model_config.py +404 -0
- pychartai-0.5.0/src/pychartai_core/model_manager.py +209 -0
- pychartai-0.5.0/src/pychartai_core/pipeline.py +334 -0
- pychartai-0.5.0/src/pychartai_core/profiler.py +171 -0
- pychartai-0.5.0/src/pychartai_core/providers.py +402 -0
- pychartai-0.5.0/src/pychartai_core/redactor.py +172 -0
- pychartai-0.5.0/src/pychartai_core/reporter.py +466 -0
- pychartai-0.5.0/src/pychartai_core/sandbox.py +865 -0
- pychartai-0.5.0/src/pychartai_core/schema.py +100 -0
- pychartai-0.5.0/src/pychartai_core/skills.py +179 -0
- pychartai-0.5.0/src/pychartai_core/smart_df.py +635 -0
- pychartai-0.5.0/src/pychartai_core/streaming.py +56 -0
- pychartai-0.5.0/src/pychartai_core/themes.py +170 -0
- pychartai-0.5.0/src/pychartai_core/visualization.py +391 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/__init__.py +29 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/base.py +85 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/catalog.py +172 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/matplotlib_backend.py +700 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/plotly_backend.py +439 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/seaborn_backend.py +839 -0
- pychartai-0.5.0/src/pychartai_core/visualization_backends/utils.py +95 -0
- pychartai-0.5.0/src/pychartai_mcp/__init__.py +1 -0
- pychartai-0.5.0/src/pychartai_mcp/agent_server.py +78 -0
- pychartai-0.5.0/src/pychartai_mcp/server.py +97 -0
- pychartai-0.5.0/src/pychartai_mcp/tools.py +251 -0
- pychartai-0.5.0/tests/test_chartai_api.py +67 -0
- pychartai-0.5.0/tests/test_charts.py +429 -0
- pychartai-0.5.0/tests/test_cli.py +40 -0
- pychartai-0.5.0/tests/test_cloud_connectors.py +247 -0
- pychartai-0.5.0/tests/test_code_sanitizer.py +128 -0
- pychartai-0.5.0/tests/test_dashboard_report.py +103 -0
- pychartai-0.5.0/tests/test_db_connectors.py +307 -0
- pychartai-0.5.0/tests/test_docker_charts.py +87 -0
- pychartai-0.5.0/tests/test_docker_sandbox.py +332 -0
- pychartai-0.5.0/tests/test_error_hints.py +58 -0
- pychartai-0.5.0/tests/test_features.py +789 -0
- pychartai-0.5.0/tests/test_integration_extensive.py +715 -0
- pychartai-0.5.0/tests/test_intent_classifier.py +121 -0
- pychartai-0.5.0/tests/test_memory.py +69 -0
- pychartai-0.5.0/tests/test_new_features.py +229 -0
- pychartai-0.5.0/tests/test_profiler.py +85 -0
- pychartai-0.5.0/tests/test_pychartai_agent.py +566 -0
- pychartai-0.5.0/tests/test_query_validation.py +133 -0
- pychartai-0.5.0/tests/test_redactor.py +148 -0
- pychartai-0.5.0/tests/test_sandbox.py +380 -0
- pychartai-0.5.0/tests/test_smart_df_features.py +58 -0
- pychartai-0.5.0/tests/test_streaming.py +355 -0
- pychartai-0.5.0/tests/test_themes.py +71 -0
pychartai-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Cem Akpolat
|
|
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.
|
pychartai-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pychartai
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: AI-powered data analysis and chart generation with 20 chart types, 3 backends, 8 LLM providers, conversation memory, auto-EDA profiling, chart themes, and RestrictedSandbox. Works standalone.
|
|
5
|
+
Author-email: Cem Akpolat <cem.akpolat@eficode.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/cemakpolat/pychartai
|
|
8
|
+
Project-URL: Homepage, https://github.com/cemakpolat/pychartai
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/cemakpolat/pychartai/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/cemakpolat/pychartai/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: pandas,llm,charts,visualization,ai,data-analysis,seaborn,plotly,matplotlib,ollama,openai,skills,schema,pipeline,sandbox
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: pandas>=2.0.0
|
|
29
|
+
Requires-Dist: numpy>=1.24.0
|
|
30
|
+
Requires-Dist: requests>=2.31.0
|
|
31
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
32
|
+
Requires-Dist: matplotlib>=3.7.0
|
|
33
|
+
Requires-Dist: seaborn>=0.12.0
|
|
34
|
+
Requires-Dist: scipy>=1.10.0
|
|
35
|
+
Requires-Dist: RestrictedPython<9,>=7.0
|
|
36
|
+
Requires-Dist: litellm<2,>=1.35.0
|
|
37
|
+
Requires-Dist: tenacity>=8.0.0
|
|
38
|
+
Provides-Extra: viz-plotly
|
|
39
|
+
Requires-Dist: plotly>=5.0.0; extra == "viz-plotly"
|
|
40
|
+
Requires-Dist: kaleido>=0.2.1; extra == "viz-plotly"
|
|
41
|
+
Provides-Extra: db-postgres
|
|
42
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "db-postgres"
|
|
43
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == "db-postgres"
|
|
44
|
+
Provides-Extra: db-mysql
|
|
45
|
+
Requires-Dist: pymysql>=1.1.0; extra == "db-mysql"
|
|
46
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == "db-mysql"
|
|
47
|
+
Provides-Extra: db-snowflake
|
|
48
|
+
Requires-Dist: snowflake-sqlalchemy>=1.5.0; extra == "db-snowflake"
|
|
49
|
+
Provides-Extra: db-bigquery
|
|
50
|
+
Requires-Dist: google-cloud-bigquery>=3.0.0; extra == "db-bigquery"
|
|
51
|
+
Requires-Dist: sqlalchemy-bigquery>=1.6.0; extra == "db-bigquery"
|
|
52
|
+
Provides-Extra: db-redshift
|
|
53
|
+
Requires-Dist: redshift-connector>=2.0.0; extra == "db-redshift"
|
|
54
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == "db-redshift"
|
|
55
|
+
Provides-Extra: db-all
|
|
56
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "db-all"
|
|
57
|
+
Requires-Dist: pymysql>=1.1.0; extra == "db-all"
|
|
58
|
+
Requires-Dist: snowflake-sqlalchemy>=1.5.0; extra == "db-all"
|
|
59
|
+
Requires-Dist: google-cloud-bigquery>=3.0.0; extra == "db-all"
|
|
60
|
+
Requires-Dist: sqlalchemy-bigquery>=1.6.0; extra == "db-all"
|
|
61
|
+
Requires-Dist: redshift-connector>=2.0.0; extra == "db-all"
|
|
62
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == "db-all"
|
|
63
|
+
Provides-Extra: cloud-s3
|
|
64
|
+
Requires-Dist: boto3>=1.26.0; extra == "cloud-s3"
|
|
65
|
+
Provides-Extra: cloud-gcs
|
|
66
|
+
Requires-Dist: google-cloud-storage>=2.10.0; extra == "cloud-gcs"
|
|
67
|
+
Provides-Extra: cloud-azure
|
|
68
|
+
Requires-Dist: azure-storage-blob>=12.14.0; extra == "cloud-azure"
|
|
69
|
+
Provides-Extra: cloud-gsheets
|
|
70
|
+
Requires-Dist: google-api-python-client>=2.80.0; extra == "cloud-gsheets"
|
|
71
|
+
Requires-Dist: google-auth>=2.16.0; extra == "cloud-gsheets"
|
|
72
|
+
Provides-Extra: cloud-all
|
|
73
|
+
Requires-Dist: boto3>=1.26.0; extra == "cloud-all"
|
|
74
|
+
Requires-Dist: google-cloud-storage>=2.10.0; extra == "cloud-all"
|
|
75
|
+
Requires-Dist: azure-storage-blob>=12.14.0; extra == "cloud-all"
|
|
76
|
+
Requires-Dist: google-api-python-client>=2.80.0; extra == "cloud-all"
|
|
77
|
+
Requires-Dist: google-auth>=2.16.0; extra == "cloud-all"
|
|
78
|
+
Provides-Extra: api
|
|
79
|
+
Requires-Dist: fastapi>=0.100.0; extra == "api"
|
|
80
|
+
Requires-Dist: uvicorn[standard]>=0.20.0; extra == "api"
|
|
81
|
+
Requires-Dist: python-multipart>=0.0.6; extra == "api"
|
|
82
|
+
Provides-Extra: mcp
|
|
83
|
+
Requires-Dist: mcp>=1.0.0; extra == "mcp"
|
|
84
|
+
Provides-Extra: dev
|
|
85
|
+
Requires-Dist: pytest>=7.4.3; extra == "dev"
|
|
86
|
+
Requires-Dist: mcp>=1.0.0; extra == "dev"
|
|
87
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
88
|
+
Requires-Dist: openpyxl>=3.1.0; extra == "dev"
|
|
89
|
+
Requires-Dist: pyarrow>=14.0.0; extra == "dev"
|
|
90
|
+
Requires-Dist: plotly>=5.0.0; extra == "dev"
|
|
91
|
+
Requires-Dist: kaleido>=0.2.1; extra == "dev"
|
|
92
|
+
Provides-Extra: docs
|
|
93
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
94
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
95
|
+
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
|
|
96
|
+
Dynamic: license-file
|
|
97
|
+
|
|
98
|
+
# pychartai
|
|
99
|
+
|
|
100
|
+
> Natural-language data analysis and chart generation.
|
|
101
|
+
> Use it as a Python library, a CLI, or an MCP server for Claude/Copilot/Cursor.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Quick Start
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install pychartai
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
import pychartai as pai
|
|
113
|
+
|
|
114
|
+
# Set DEEPSEEK_API_KEY in .env, then:
|
|
115
|
+
pai.init(provider="deepseek", model="deepseek-chat")
|
|
116
|
+
|
|
117
|
+
df = pai.read_csv("data.csv")
|
|
118
|
+
print(df.chat("What is revenue by region?"))
|
|
119
|
+
path = df.chat("Bar chart of revenue by region") # interactive HTML
|
|
120
|
+
print(df.profile().summary) # auto-EDA, no LLM
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Three Ways to Use It
|
|
124
|
+
|
|
125
|
+
### 1. MCP Server (for Claude Desktop / Copilot / Cursor)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
make mcp-server
|
|
129
|
+
# or: pychartai-mcp
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Add to `claude_desktop_config.json`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"pychartai": {
|
|
138
|
+
"command": "python",
|
|
139
|
+
"args": ["-m", "pychartai_mcp.server"],
|
|
140
|
+
"env": {"DEEPSEEK_API_KEY": "sk-..."}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Then in Claude: *"Load sales.csv and show revenue by region as a chart"*
|
|
147
|
+
|
|
148
|
+
**Available MCP tools:** `analyze_data`, `create_chart`, `profile_data`
|
|
149
|
+
|
|
150
|
+
### 2. Python Library
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import pychartai as pai
|
|
154
|
+
|
|
155
|
+
pai.init(provider="deepseek", model="deepseek-chat")
|
|
156
|
+
|
|
157
|
+
sdf = pai.read_csv("sales.csv")
|
|
158
|
+
print(sdf.chat("Top 3 products by revenue?"))
|
|
159
|
+
path = sdf.chat("Bar chart of revenue by region")
|
|
160
|
+
|
|
161
|
+
# Streaming, memory, profiling
|
|
162
|
+
for event in sdf.chat_stream("Summarize this"):
|
|
163
|
+
if event.type == "token": print(event.value, end="")
|
|
164
|
+
sdf.enable_memory()
|
|
165
|
+
sdf.chat("Follow-up question")
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 3. CLI
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
pychartai data.csv "Revenue by region?"
|
|
172
|
+
pychartai data.csv --profile # auto-EDA, no LLM
|
|
173
|
+
pychartai data.csv "Bar chart" --backend plotly
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Features
|
|
177
|
+
|
|
178
|
+
| Category | What you get |
|
|
179
|
+
|---|---|
|
|
180
|
+
| **Chart backends** | Seaborn (PNG) · Matplotlib (PNG) · Plotly (interactive HTML) |
|
|
181
|
+
| **Chart types** | 20: area · bar · box · bubble · count · ecdf · funnel · heatmap · histogram · kde · line · pairplot · pie · regression · scatter · stacked_bar · step · strip · swarm · violin |
|
|
182
|
+
| **LLM Providers** | DeepSeek · OpenAI · GitHub · Gemini · Anthropic · Qwen · Ollama |
|
|
183
|
+
| **Sandbox** | RestrictedPython (default) · Docker (optional) |
|
|
184
|
+
| **Data connectors** | CSV · Excel · JSON · Parquet · PostgreSQL · MySQL · Snowflake · BigQuery · Redshift · S3 · GCS · Azure Blob · Google Sheets |
|
|
185
|
+
| **Memory** | Sliding-window conversation memory for follow-up queries |
|
|
186
|
+
| **Profiling** | `df.profile()` — stats, missing values, correlations (no LLM) |
|
|
187
|
+
| **MCP Server** | Expose data analysis as tools for Claude/Copilot/Cursor |
|
|
188
|
+
|
|
189
|
+
## Installation
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pip install pychartai
|
|
193
|
+
|
|
194
|
+
# Optional extras:
|
|
195
|
+
pip install pychartai[viz-plotly] # interactive Plotly charts
|
|
196
|
+
pip install pychartai[db-postgres] # PostgreSQL connector
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Set your API key in `.env`:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
DEEPSEEK_API_KEY=sk-...
|
|
203
|
+
OPENAI_API_KEY=sk-...
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Configuration
|
|
207
|
+
|
|
208
|
+
### models.yml (auto-discovered)
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
default_model: deepseek-v4-flash
|
|
212
|
+
models:
|
|
213
|
+
deepseek-v4-flash:
|
|
214
|
+
provider: deepseek
|
|
215
|
+
model: deepseek-chat
|
|
216
|
+
api_key_env: DEEPSEEK_API_KEY
|
|
217
|
+
settings:
|
|
218
|
+
chart_backend: plotly
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
pai.init() # auto-discover + default_model
|
|
223
|
+
pai.init(model="deepseek-v4-flash") # by name
|
|
224
|
+
pai.init(provider="deepseek", model="deepseek-chat") # inline
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Makefile Reference
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Setup: make install make venv make prepare-data
|
|
231
|
+
Offline: make test make demo make gallery
|
|
232
|
+
With LLM: make demo-advanced [PROVIDER=deepseek]
|
|
233
|
+
MCP: make mcp-server
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
MIT
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# pychartai
|
|
2
|
+
|
|
3
|
+
> Natural-language data analysis and chart generation.
|
|
4
|
+
> Use it as a Python library, a CLI, or an MCP server for Claude/Copilot/Cursor.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install pychartai
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import pychartai as pai
|
|
16
|
+
|
|
17
|
+
# Set DEEPSEEK_API_KEY in .env, then:
|
|
18
|
+
pai.init(provider="deepseek", model="deepseek-chat")
|
|
19
|
+
|
|
20
|
+
df = pai.read_csv("data.csv")
|
|
21
|
+
print(df.chat("What is revenue by region?"))
|
|
22
|
+
path = df.chat("Bar chart of revenue by region") # interactive HTML
|
|
23
|
+
print(df.profile().summary) # auto-EDA, no LLM
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Three Ways to Use It
|
|
27
|
+
|
|
28
|
+
### 1. MCP Server (for Claude Desktop / Copilot / Cursor)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
make mcp-server
|
|
32
|
+
# or: pychartai-mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Add to `claude_desktop_config.json`:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"pychartai": {
|
|
41
|
+
"command": "python",
|
|
42
|
+
"args": ["-m", "pychartai_mcp.server"],
|
|
43
|
+
"env": {"DEEPSEEK_API_KEY": "sk-..."}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then in Claude: *"Load sales.csv and show revenue by region as a chart"*
|
|
50
|
+
|
|
51
|
+
**Available MCP tools:** `analyze_data`, `create_chart`, `profile_data`
|
|
52
|
+
|
|
53
|
+
### 2. Python Library
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import pychartai as pai
|
|
57
|
+
|
|
58
|
+
pai.init(provider="deepseek", model="deepseek-chat")
|
|
59
|
+
|
|
60
|
+
sdf = pai.read_csv("sales.csv")
|
|
61
|
+
print(sdf.chat("Top 3 products by revenue?"))
|
|
62
|
+
path = sdf.chat("Bar chart of revenue by region")
|
|
63
|
+
|
|
64
|
+
# Streaming, memory, profiling
|
|
65
|
+
for event in sdf.chat_stream("Summarize this"):
|
|
66
|
+
if event.type == "token": print(event.value, end="")
|
|
67
|
+
sdf.enable_memory()
|
|
68
|
+
sdf.chat("Follow-up question")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. CLI
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pychartai data.csv "Revenue by region?"
|
|
75
|
+
pychartai data.csv --profile # auto-EDA, no LLM
|
|
76
|
+
pychartai data.csv "Bar chart" --backend plotly
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Features
|
|
80
|
+
|
|
81
|
+
| Category | What you get |
|
|
82
|
+
|---|---|
|
|
83
|
+
| **Chart backends** | Seaborn (PNG) · Matplotlib (PNG) · Plotly (interactive HTML) |
|
|
84
|
+
| **Chart types** | 20: area · bar · box · bubble · count · ecdf · funnel · heatmap · histogram · kde · line · pairplot · pie · regression · scatter · stacked_bar · step · strip · swarm · violin |
|
|
85
|
+
| **LLM Providers** | DeepSeek · OpenAI · GitHub · Gemini · Anthropic · Qwen · Ollama |
|
|
86
|
+
| **Sandbox** | RestrictedPython (default) · Docker (optional) |
|
|
87
|
+
| **Data connectors** | CSV · Excel · JSON · Parquet · PostgreSQL · MySQL · Snowflake · BigQuery · Redshift · S3 · GCS · Azure Blob · Google Sheets |
|
|
88
|
+
| **Memory** | Sliding-window conversation memory for follow-up queries |
|
|
89
|
+
| **Profiling** | `df.profile()` — stats, missing values, correlations (no LLM) |
|
|
90
|
+
| **MCP Server** | Expose data analysis as tools for Claude/Copilot/Cursor |
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install pychartai
|
|
96
|
+
|
|
97
|
+
# Optional extras:
|
|
98
|
+
pip install pychartai[viz-plotly] # interactive Plotly charts
|
|
99
|
+
pip install pychartai[db-postgres] # PostgreSQL connector
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Set your API key in `.env`:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
DEEPSEEK_API_KEY=sk-...
|
|
106
|
+
OPENAI_API_KEY=sk-...
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
### models.yml (auto-discovered)
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
default_model: deepseek-v4-flash
|
|
115
|
+
models:
|
|
116
|
+
deepseek-v4-flash:
|
|
117
|
+
provider: deepseek
|
|
118
|
+
model: deepseek-chat
|
|
119
|
+
api_key_env: DEEPSEEK_API_KEY
|
|
120
|
+
settings:
|
|
121
|
+
chart_backend: plotly
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
pai.init() # auto-discover + default_model
|
|
126
|
+
pai.init(model="deepseek-v4-flash") # by name
|
|
127
|
+
pai.init(provider="deepseek", model="deepseek-chat") # inline
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Makefile Reference
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
Setup: make install make venv make prepare-data
|
|
134
|
+
Offline: make test make demo make gallery
|
|
135
|
+
With LLM: make demo-advanced [PROVIDER=deepseek]
|
|
136
|
+
MCP: make mcp-server
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pychartai"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "AI-powered data analysis and chart generation with 20 chart types, 3 backends, 8 LLM providers, conversation memory, auto-EDA profiling, chart themes, and RestrictedSandbox. Works standalone."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [{ name = "Cem Akpolat", email = "cem.akpolat@eficode.com" }]
|
|
13
|
+
keywords = ["pandas", "llm", "charts", "visualization", "ai", "data-analysis", "seaborn", "plotly", "matplotlib", "ollama", "openai", "skills", "schema", "pipeline", "sandbox"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.9",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Development Status :: 5 - Production/Stable",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"pandas>=2.0.0",
|
|
31
|
+
"numpy>=1.24.0",
|
|
32
|
+
"requests>=2.31.0",
|
|
33
|
+
"python-dotenv>=1.0.0",
|
|
34
|
+
"matplotlib>=3.7.0",
|
|
35
|
+
"seaborn>=0.12.0",
|
|
36
|
+
"scipy>=1.10.0",
|
|
37
|
+
"RestrictedPython>=7.0,<9",
|
|
38
|
+
"litellm>=1.35.0,<2",
|
|
39
|
+
"tenacity>=8.0.0",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
pychartai = "pychartai.cli:main"
|
|
44
|
+
pychartai-mcp = "pychartai_mcp.server:main"
|
|
45
|
+
pychartai-mcp-agent = "pychartai_mcp.agent_server:main"
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
# Interactive HTML charts + static image export via Plotly (adds ~80 MB for kaleido)
|
|
49
|
+
viz-plotly = [
|
|
50
|
+
"plotly>=5.0.0",
|
|
51
|
+
"kaleido>=0.2.1",
|
|
52
|
+
]
|
|
53
|
+
# Database connectors (install as needed)
|
|
54
|
+
db-postgres = [
|
|
55
|
+
"psycopg2-binary>=2.9.0",
|
|
56
|
+
"sqlalchemy>=2.0.0",
|
|
57
|
+
]
|
|
58
|
+
db-mysql = [
|
|
59
|
+
"pymysql>=1.1.0",
|
|
60
|
+
"sqlalchemy>=2.0.0",
|
|
61
|
+
]
|
|
62
|
+
db-snowflake = [
|
|
63
|
+
"snowflake-sqlalchemy>=1.5.0",
|
|
64
|
+
]
|
|
65
|
+
db-bigquery = [
|
|
66
|
+
"google-cloud-bigquery>=3.0.0",
|
|
67
|
+
"sqlalchemy-bigquery>=1.6.0",
|
|
68
|
+
]
|
|
69
|
+
db-redshift = [
|
|
70
|
+
"redshift-connector>=2.0.0",
|
|
71
|
+
"sqlalchemy>=2.0.0",
|
|
72
|
+
]
|
|
73
|
+
db-all = [
|
|
74
|
+
"psycopg2-binary>=2.9.0",
|
|
75
|
+
"pymysql>=1.1.0",
|
|
76
|
+
"snowflake-sqlalchemy>=1.5.0",
|
|
77
|
+
"google-cloud-bigquery>=3.0.0",
|
|
78
|
+
"sqlalchemy-bigquery>=1.6.0",
|
|
79
|
+
"redshift-connector>=2.0.0",
|
|
80
|
+
"sqlalchemy>=2.0.0",
|
|
81
|
+
]
|
|
82
|
+
# Cloud storage / SaaS connectors (install as needed)
|
|
83
|
+
cloud-s3 = [
|
|
84
|
+
"boto3>=1.26.0",
|
|
85
|
+
]
|
|
86
|
+
cloud-gcs = [
|
|
87
|
+
"google-cloud-storage>=2.10.0",
|
|
88
|
+
]
|
|
89
|
+
cloud-azure = [
|
|
90
|
+
"azure-storage-blob>=12.14.0",
|
|
91
|
+
]
|
|
92
|
+
cloud-gsheets = [
|
|
93
|
+
"google-api-python-client>=2.80.0",
|
|
94
|
+
"google-auth>=2.16.0",
|
|
95
|
+
]
|
|
96
|
+
cloud-all = [
|
|
97
|
+
"boto3>=1.26.0",
|
|
98
|
+
"google-cloud-storage>=2.10.0",
|
|
99
|
+
"azure-storage-blob>=12.14.0",
|
|
100
|
+
"google-api-python-client>=2.80.0",
|
|
101
|
+
"google-auth>=2.16.0",
|
|
102
|
+
]
|
|
103
|
+
api = [
|
|
104
|
+
"fastapi>=0.100.0",
|
|
105
|
+
"uvicorn[standard]>=0.20.0",
|
|
106
|
+
"python-multipart>=0.0.6",
|
|
107
|
+
]
|
|
108
|
+
mcp = [
|
|
109
|
+
"mcp>=1.0.0",
|
|
110
|
+
]
|
|
111
|
+
dev = [
|
|
112
|
+
"pytest>=7.4.3",
|
|
113
|
+
"mcp>=1.0.0",
|
|
114
|
+
"pytest-cov>=4.1.0",
|
|
115
|
+
"openpyxl>=3.1.0",
|
|
116
|
+
"pyarrow>=14.0.0",
|
|
117
|
+
"plotly>=5.0.0",
|
|
118
|
+
"kaleido>=0.2.1",
|
|
119
|
+
]
|
|
120
|
+
docs = [
|
|
121
|
+
"mkdocs>=1.5.0",
|
|
122
|
+
"mkdocs-material>=9.0.0",
|
|
123
|
+
"mkdocstrings[python]>=0.24.0",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[project.urls]
|
|
127
|
+
Repository = "https://github.com/cemakpolat/pychartai"
|
|
128
|
+
Homepage = "https://github.com/cemakpolat/pychartai"
|
|
129
|
+
"Bug Tracker" = "https://github.com/cemakpolat/pychartai/issues"
|
|
130
|
+
Changelog = "https://github.com/cemakpolat/pychartai/blob/main/CHANGELOG.md"
|
|
131
|
+
|
|
132
|
+
[tool.setuptools.packages.find]
|
|
133
|
+
where = ["src"]
|
|
134
|
+
include = ["pychartai*"]
|
|
135
|
+
|
|
136
|
+
[tool.setuptools.package-dir]
|
|
137
|
+
"" = "src"
|
|
138
|
+
|
|
139
|
+
[tool.pytest.ini_options]
|
|
140
|
+
testpaths = ["tests"]
|
|
141
|
+
addopts = "-ra -q"
|
|
142
|
+
|
|
143
|
+
[tool.coverage.run]
|
|
144
|
+
source = ["src"]
|
|
145
|
+
omit = ["tests/*"]
|
|
146
|
+
|
|
147
|
+
[tool.coverage.report]
|
|
148
|
+
show_missing = true
|
|
149
|
+
skip_covered = false
|
pychartai-0.5.0/setup.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Minimal setup.py for pychartai.
|
|
3
|
+
|
|
4
|
+
Build configuration lives in ``pyproject.toml``.
|
|
5
|
+
This file exists for backward compatibility with older pip/setuptools
|
|
6
|
+
workflows that expect a ``setup.py``, such as:
|
|
7
|
+
|
|
8
|
+
pip install -e . # editable install
|
|
9
|
+
python setup.py sdist # source distribution
|
|
10
|
+
python setup.py bdist_wheel # wheel distribution
|
|
11
|
+
|
|
12
|
+
All project metadata, dependencies, and entry points are defined in
|
|
13
|
+
``pyproject.toml`` under the ``[project]`` section. This file delegates
|
|
14
|
+
to setuptools which reads that configuration automatically.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from setuptools import setup
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
setup()
|