Metadata-Version: 2.4
Name: dante-ds
Version: 0.5.0
Summary: MCP server + skills that turn Claude Code into a data science workbench
License: Dante Limited License v1.0
        
        Copyright (c) 2026 Sean Cook. All rights reserved.
        
        Grant of License
        
        Permission is granted solely to the following entities (the "Authorized Entities"):
        
        - Ontra, LLC
        - Superhuman Platform Inc. (formerly Grammarly, Inc.)
        
        Authorized Entities may use, copy, and modify the Dante software (the "Software") for their internal business purposes only.
        
        Restrictions
        
        1. No Redistribution
        Authorized Entities may not distribute, sublicense, share, publish, provide access to, or otherwise make the Software or any derivative works available to any third party without prior written permission from the author.
        
        2. Internal Use Only
        Use of the Software is strictly limited to internal use within the Authorized Entities. The Software may not be used to provide services, tools, or functionality to external organizations, clients, partners, or affiliates without explicit written permission from the author.
        
        3. Non-Transferable
        This license is non-transferable and applies only to the Authorized Entities listed above. Employees, contractors, and agents of the Authorized Entities may use the Software solely as part of their work for the Authorized Entities and subject to the terms of this license.
        
        4. No Commercial Distribution
        Authorized Entities may not sell, license, sublicense, commercialize, or otherwise distribute the Software or any derivative works outside their organization without explicit written permission from the author.
        
        5. Ownership
        All rights, title, and interest in and to the Software, including all intellectual property rights, remain exclusively with the author. This license grants only limited usage rights and does not transfer ownership.
        
        6. Contributions
        Any modifications, improvements, or contributions made to the Software by the Authorized Entities may be used, incorporated, sublicensed, and redistributed by the author without restriction or obligation.
        
        7. Revocation
        The author reserves the right to revoke this license at any time with written notice. Upon revocation, the Authorized Entities must cease use of the Software and destroy all copies within a reasonable timeframe.
        
        Contact
        
        For additional licensing rights, including commercial licensing or use by other entities, contact:
        
        seangcook@gmail.com
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: click>=8.0
Requires-Dist: kaleido>=0.2
Requires-Dist: mcp>=1.0
Requires-Dist: openai>=1.0
Requires-Dist: pandas>=2.0
Requires-Dist: plotly>=5.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: tenacity>=8.0
Provides-Extra: all
Requires-Dist: databricks-sql-connector>=3.0; extra == 'all'
Requires-Dist: looker-sdk>=24.0; extra == 'all'
Requires-Dist: psycopg2-binary>=2.9; extra == 'all'
Requires-Dist: pymysql>=1.1; extra == 'all'
Requires-Dist: snowflake-sqlalchemy>=1.5; extra == 'all'
Requires-Dist: sqlalchemy-bigquery>=1.8; extra == 'all'
Provides-Extra: bigquery
Requires-Dist: sqlalchemy-bigquery>=1.8; extra == 'bigquery'
Provides-Extra: databricks
Requires-Dist: databricks-sql-connector>=3.0; extra == 'databricks'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: looker
Requires-Dist: looker-sdk>=24.0; extra == 'looker'
Provides-Extra: mysql
Requires-Dist: pymysql>=1.1; extra == 'mysql'
Provides-Extra: postgres
Requires-Dist: psycopg2-binary>=2.9; extra == 'postgres'
Provides-Extra: snowflake
Requires-Dist: snowflake-sqlalchemy>=1.5; extra == 'snowflake'
Description-Content-Type: text/markdown

# dante-lib

A data science workbench for Claude Code. Gives Claude MCP tools to query databases, build charts, manage knowledge, and create data apps — all from your terminal.

## What it does

- **SQL tools** — execute queries, list tables, describe schemas, profile data
- **Knowledge** — save validated SQL patterns with embeddings, keyword triggers, and project notes
- **Charts & apps** — generate Plotly charts and self-contained HTML data apps
- **Embedding ingestion** — bulk import SQL patterns from Looker, Databricks, or your warehouse
- **Management UI** — web UI to configure connections, credentials, and knowledge

## Install

```bash
pip install dante-lib
# or with uv
uv tool install dante-lib
```

For specific database drivers:

```bash
pip install "dante-lib[snowflake]"
pip install "dante-lib[databricks]"
pip install "dante-lib[bigquery]"
pip install "dante-lib[postgres]"
pip install "dante-lib[mysql]"
pip install "dante-lib[all]"   # everything
```

Requires Python 3.11+ and an OpenAI API key for embeddings.

## Quick start

```bash
# Create a new project
dante launch my-project
cd my-project

# Or initialize in an existing directory
dante launch

# Open the management UI to configure your database connection
dante ui
```

Then open Claude Code in the project directory. The `.mcp.json` file is already configured — Claude will have access to all dante tools automatically.

## Project structure

After `dante launch`:

```
my-project/
├── .mcp.json                  # Claude Code MCP config (auto-configured)
├── CLAUDE.md                  # Tool reference loaded by Claude each session
├── .dante/
│   ├── config.yaml            # Default connection
│   ├── knowledge/
│   │   ├── keywords.yaml      # Keyword → SQL hint mappings
│   │   ├── notes.md           # Free-form notes Claude reads each session
│   │   └── patterns/          # Saved SQL patterns (.sql files)
│   └── embeddings.db          # SQLite embedding index (gitignored)
├── .claude/skills/            # Slash commands (/query, /dashboard, /analyze, ...)
├── analysis/                  # Analysis scripts
├── outputs/                   # Generated charts, dashboards, reports
└── data/                      # Local data files
```

## MCP tools

Claude gets these tools when it opens the project:

| Tool | What it does |
|------|-------------|
| `dante_sql` | Execute read-only SQL. Auto-injects LIMIT. Returns markdown table. |
| `dante_tables` | List tables, optionally filter by schema. |
| `dante_describe` | Column names, types, nullability, sample values for a table. |
| `dante_profile` | Row count, null rates, cardinality, distributions. |
| `dante_search` | Semantic search across embeddings + keywords. Returns matching SQL. |
| `dante_save_pattern` | Save validated SQL and generate an embedding for future search. |
| `dante_chart` | Generate a Plotly chart → HTML or PNG. |
| `dante_app_create` | Create a data app from a template (dashboard, report, map, profile, blank). |
| `dante_app_add_value` | Bind a SQL query to a computed value slot in a data app. |
| `dante_app_render` | Execute all queries, substitute values, write final HTML. |
| `dante_checkpoint` | Snapshot `analysis/` and `outputs/` directories. |
| `dante_rollback` | Restore to a previous checkpoint. |

## Slash commands

Skills scaffolded into `.claude/skills/`:

| Command | What it does |
|---------|-------------|
| `/query` | Explore data — searches knowledge first, then explores schema and runs SQL |
| `/dashboard [title]` | Build an interactive HTML dashboard from scratch |
| `/analyze [question]` | Multi-step analysis with checkpoints and a final report |
| `/ingest [--source]` | Run the embedding ingestion pipeline |
| `/report [title]` | Compile analysis scripts and charts into an HTML report |

## Python library

Use `import dante` in analysis scripts for DataFrame-based work:

```python
import dante

df = dante.sql("SELECT * FROM orders LIMIT 100")
dante.tables()
dante.describe("orders")
dante.profile("orders")
dante.chart(df, x="date", y="revenue", kind="bar", title="Revenue")

dante.knowledge.search("monthly revenue by region")
dante.knowledge.save_pattern("monthly_revenue", sql="...", description="...")

dante.checkpoint("before-pivot")
dante.rollback("before-pivot")
```

## Embedding ingestion

Pull SQL patterns from BI platforms into the local embedding index:

```bash
# From the CLI
dante ingest --source looker
dante ingest --source databricks
dante ingest --source all --dry-run

# Or from the management UI
dante ui
```

Ingestion pulls dashboard titles and SQL, generates natural-language questions with GPT-4o-mini, creates OpenAI embeddings, and upserts into `embeddings.db`. Claude then finds these patterns when you call `/query`.

Connections for Looker and Databricks are configured in the management UI and stored in `~/.dante/credentials.yaml` (global, not per-project).

## Management UI

```bash
dante ui           # opens at http://localhost:4040
dante ui --port 8080
```

Configure database connections, API credentials, and keywords. Connections are stored globally (`~/.dante/`) so the same connection works across all your projects.

## CLI reference

```bash
dante launch [name]          # scaffold a new project (or init in place)
dante ui [--port PORT]       # open the management UI
dante mcp serve              # start the MCP server (called by Claude via .mcp.json)
dante ingest [--source ...]  # run embedding ingestion
dante status [--json]        # show connection, knowledge stats, and output count
dante open [name]            # open a generated artifact in the browser
```

## Configuration

**Per-project** (`.dante/config.yaml`):
```yaml
default_connection: my-warehouse
```

**Global** (`~/.dante/connections.yaml`):
```yaml
my-warehouse:
  dialect: snowflake
  account: xy12345
  database: ANALYTICS
  warehouse: COMPUTE_WH
  role: ANALYST
```

**Global credentials** (`~/.dante/credentials.yaml`):
```yaml
openai:
  api_key: sk-...
looker:
  base_url: https://company.looker.com
  client_id: ...
  client_secret: ...
```

## License

MIT
