Skip to main content

pychartai

Natural-language data analysis and chart generation. Use it as a Python library, a CLI, or an MCP server for Claude/Copilot/Cursor.


Quick Start

pip install pychartai
import pychartai as pai

# Set DEEPSEEK_API_KEY in .env, then:
pai.init(provider="deepseek", model="deepseek-chat")

df = pai.read_csv("data.csv")
print(df.chat("What is revenue by region?"))
path = df.chat("Bar chart of revenue by region")  # interactive HTML
print(df.profile().summary)                        # auto-EDA, no LLM

Three Ways to Use It

1. MCP Server (for Claude Desktop / Copilot / Cursor)

make mcp-server
# or: pychartai-mcp

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "pychartai": {
      "command": "python",
      "args": ["-m", "pychartai_mcp.server"],
      "env": {"DEEPSEEK_API_KEY": "sk-..."}
    }
  }
}

Then in Claude: "Load sales.csv and show revenue by region as a chart"

Available MCP tools: analyze_data, create_chart, profile_data

2. Python Library

import pychartai as pai

pai.init(provider="deepseek", model="deepseek-chat")

sdf = pai.read_csv("sales.csv")
print(sdf.chat("Top 3 products by revenue?"))
path = sdf.chat("Bar chart of revenue by region")

# Streaming, memory, profiling
for event in sdf.chat_stream("Summarize this"):
    if event.type == "token": print(event.value, end="")
sdf.enable_memory()
sdf.chat("Follow-up question")

3. CLI

pychartai data.csv "Revenue by region?"
pychartai data.csv --profile          # auto-EDA, no LLM
pychartai data.csv "Bar chart" --backend plotly

Features

Category What you get
Chart backends Seaborn (PNG) · Matplotlib (PNG) · Plotly (interactive HTML)
Chart types 20: area · bar · box · bubble · count · ecdf · funnel · heatmap · histogram · kde · line · pairplot · pie · regression · scatter · stacked_bar · step · strip · swarm · violin
LLM Providers DeepSeek · OpenAI · GitHub · Gemini · Anthropic · Qwen · Ollama
Sandbox RestrictedPython (default) · Docker (optional)
Data connectors CSV · Excel · JSON · Parquet · PostgreSQL · MySQL · Snowflake · BigQuery · Redshift · S3 · GCS · Azure Blob · Google Sheets
Memory Sliding-window conversation memory for follow-up queries
Profiling df.profile() — stats, missing values, correlations (no LLM)
MCP Server Expose data analysis as tools for Claude/Copilot/Cursor

Installation

pip install pychartai

# Optional extras:
pip install pychartai[viz-plotly]   # interactive Plotly charts
pip install pychartai[db-postgres]  # PostgreSQL connector

Set your API key in .env:

DEEPSEEK_API_KEY=sk-...
OPENAI_API_KEY=sk-...

Configuration

models.yml (auto-discovered)

default_model: deepseek-v4-flash
models:
  deepseek-v4-flash:
    provider: deepseek
    model: deepseek-chat
    api_key_env: DEEPSEEK_API_KEY
settings:
  chart_backend: plotly
pai.init()                              # auto-discover + default_model
pai.init(model="deepseek-v4-flash")     # by name
pai.init(provider="deepseek", model="deepseek-chat")  # inline

Makefile Reference

Setup:     make install    make venv    make prepare-data
Offline:   make test       make demo    make gallery
With LLM:  make demo-advanced [PROVIDER=deepseek]
MCP:       make mcp-server

License

MIT

Metadata

Release files for pychartai 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pychartai 0.5.0
File Size Uploaded
pychartai-0.5.0.tar.gz 153.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pychartai 0.5.0
File Interpreter ABI Platform
pychartai-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 282.9 kB

Release files / pychartai-0.5.0.tar.gz

Download URL pychartai-0.5.0.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5f624d61ff98ed1de63cf15622bfbb94d9cfbd368ccf451ae9b1cbd62a7a2de2
BLAKE2b-256 checksum
How to use checksums
3df6a4e3aeb5c25055d8ec7cf40dab2d290d897fd56ef3d1018037d1f9b5bb43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.

Transparency log

Release files / pychartai-0.5.0-py3-none-any.whl

Download URL pychartai-0.5.0-py3-none-any.whl
Size 129.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27c78de080f548cba30f81ee8eccbdca4a5c90e79888cce9a0114d1741914538
BLAKE2b-256 checksum
How to use checksums
7fd434f0fa71eee6ef426b90ad053a4aebabed61e1a84151f6b3948ec87f253c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page