MVP: Load CSV/Excel/JSON into a pandas DataFrame via speak2py()
Project description
Speak2Py
Version: MVP v0.1
🎯 Objective
Let users run any Python logic—data loading, analysis, plotting, even algorithm, data structures generation—by writing plain-English commands. The MVP proves out:
- English→Python translation via a hosted AI (Gemini on Vertex AI)
- Safe execution of the generated code and return of results
- Zero-config UX: no local AI models, no credentials, just install and run
📝 Overview
Speak2Py accepts natural-language prompts such as:
- “read file ‘data.csv’ and head 5”
- “plot x vs y from ‘data.csv’”
- “generate prime numbers up to 100 and assign to result”
Behind the scenes it:
- Sends your prompt to a hosted FastAPI service on Cloud Run
- Calls Gemini to produce a Python snippet assigning its output to
result - Executes that snippet in a sandboxed namespace
- Serializes and returns
resultas a DataFrame, list, or plot
End users simply:
pip install speak2py
MVP Features (v0.1)
-
Natural-Language Commands
- CLI:
speak2py "read file 'data.csv' and head 5" --show
- Python API:
from speak2py import speak2py df = speak2py("load 'data.csv' and describe")
- CLI:
-
AI-Driven Code Generation
- Sends your English prompt to a hosted Gemini/Vertex AI service
- Automatically generates and executes a Python snippet assigning the final object to
result
-
Zero-Config Deployment
- No GCP credentials or environment variables needed for end-users
- All AI calls go through our Cloud Run service under our own service account
-
Local Fallback
- If the AI service is unreachable, basic
read|load … + head|describestill works via regex parsing
- If the AI service is unreachable, basic
-
File Loading
- Detects
.csv,.xls,.xlsx, and.jsonby extension - Returns a
pandas.DataFrame
- Detects
-
Plotting Support
- Generates histograms, scatter plots, line plots, etc.
- Returns a
matplotlib.axes.Axesfor further customization
-
CLI & Packaging Structure
cli.pyexposes thespeak2pyshell commandsrc/speak2py/__init__.pyprovides thespeak2py()function
-
Testing & Observability
- Unit tests for file loading and regex fallback
- Integration tests for both CLI and Python API
- Server logs LLM latency, execution time, and errors
📦 Installation
pip install speak2py
MVP v0.3 Description
-
Purpose:
Empower anyone to write and execute Python data‐analysis or algorithmic code using plain-English prompts—without installing AI libraries or managing credentials. -
What’s Included:
speak2py(command: str) → DataFrame | Axes
Sends your English command to a hosted AI service, executes the returned snippet, and returns the result.- Local Regex Fallback
For simpleread|load … + head|describecommands when offline. - File Formats
.csv,.xls/.xlsx,.jsonautomatically detected and loaded into pandas. - Plotting
Histogram, scatter, line‐plot support via matplotlib, returned asAxes. - CLI Tool
speak2py "..." --show [--out file]for shell usage. - Zero-Config Deployment
All AI inference happens on our Cloud Run endpoint—no GCP setup on the client side. - Testing & Observability
Unit tests (file loading, fallback) and integration tests (AI client + execution).
Server‐side logs of LLM latency, execution time, and errors.
-
Why It Matters:
This MVP lays the groundwork for making Python coding accessible—non-developers can load data, visualize it, or even run algorithms (e.g. prime number generation) by simply typing what they want in English.
Next Steps & Roadmap
-
Extended Plot Types
Boxplots, pivot‐tables, pairwise scatter‐matrix. -
More Data Sources
Parquet, SQL databases, REST APIs, GCS buckets. -
Advanced Prompting
Few‐shot examples, customizable templates, context retention. -
IDE/Notebook Integration
JupyterMagics (e.g.%%speak2py), VS Code extension. -
User‐Defined Macros
Let users define their own English→Python shortcuts. -
Security & Sandboxing
Harden execution sandbox, validate generated code before running. -
Analytics & Usage Dashboard
Track popular commands, lagging bottlenecks, error trends.
Contributing
Contributions welcome! Please open an issue or submit a pull request.
License
MIT © 2025 Speak2Py Contributors
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speak2py-0.1.1.tar.gz.
File metadata
- Download URL: speak2py-0.1.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a281585ebf8375d3405998f2bfa4cc6a5879b7d4238d4a56fe4debde53bb91b7
|
|
| MD5 |
aa1985c5a79f0ad59fc44936978cccd3
|
|
| BLAKE2b-256 |
ff51ea9f80bf82c3a4f356ad4ddf7b8c3551bdecc41e6898a2555be10a79a23d
|
File details
Details for the file speak2py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: speak2py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8a30b226e6c385d46cd11a40401c4cca602b29220e4fae8cde142954b5edeaa
|
|
| MD5 |
26ed2ce4df26dbba5b9130422ba0bc4f
|
|
| BLAKE2b-256 |
a8a42605404d1f3fd655eb02acc32fcb28831e403223e7ce7c61214ffc01c0fb
|