| name | local-code-interpreter | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Execute Python code and shell commands locally on macOS/Linux. No API key, no cloud service — runs directly on your machine. | ||||||||||||
| metadata |
|
Run Python code and shell commands directly on your local machine. No cloud, no API keys, no cold starts — uses the Python already installed on your system.
Use this skill whenever you need to actually execute code to get a result:
| Task | Use This? |
|---|---|
| Data analysis with pandas/numpy | ✅ Yes |
| Generate charts and visualizations | ✅ Yes |
| Process files (CSV, Excel, JSON, PDF) | ✅ Yes |
| Machine learning with scikit-learn | ✅ Yes |
| Math / statistics calculations | ✅ Yes |
| Explaining code or algorithms | ❌ No — respond with text |
| Formatting code examples | ❌ No — use markdown code blocks |
| Simple mental math | ❌ No — just answer directly |
python3 {baseDir}/scripts/run.py --code "print('hello')"Write code to a temp file, then execute:
cat > /tmp/ci_script.py << 'PYEOF'
import pandas as pd
import numpy as np
data = {'month': ['Jan','Feb','Mar'], 'revenue': [12, 19, 15]}
df = pd.DataFrame(data)
print(df.describe())
PYEOF
python3 /tmp/ci_script.pypython3 {baseDir}/scripts/run.py --file /path/to/script.pyUse the built-in execute_command tool directly — no wrapper needed:
pip3 install pandas matplotlib
ls -la-
Non-interactive matplotlib backend — always add before pyplot import:
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt
-
Chinese text in charts — set font to avoid missing glyphs:
plt.rcParams['font.family'] = 'PingFang HK' # macOS # plt.rcParams['font.family'] = 'WenQuanYi Zen Hei' # Linux
-
Use
print()for output — stdout is the only output channel. -
Save charts with
savefig(), neverplt.show():plt.savefig('/tmp/output.png', dpi=150, bbox_inches='tight')
-
Default output directory is
/tmp/— specify a different path explicitly if needed. -
Install missing packages first:
pip3 install <package>
Install any missing ones with pip3 install <name>.
| Category | Libraries |
|---|---|
| Data Analysis | pandas, numpy |
| Visualization | matplotlib, plotly, seaborn |
| Machine Learning | scikit-learn, xgboost |
| Excel / Office | openpyxl, python-docx, python-pptx |
PyPDF2, reportlab, pdfplumber |
|
| Image | Pillow, opencv-python |
| HTTP / Scraping | requests, httpx, beautifulsoup4 |
| Math | scipy, sympy |
| Utilities | rich, pydantic, tqdm |
import pandas as pd
import numpy as np
df = pd.read_csv('/path/to/data.csv')
print("Shape:", df.shape)
print("\nMissing values:")
print(df.isnull().sum())
print("\nStatistics:")
print(df.describe())import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.family'] = 'PingFang HK'
months = ['1月', '2月', '3月', '4月', '5月', '6月']
values = [12, 19, 15, 25, 22, 30]
plt.figure(figsize=(8, 4))
plt.plot(months, values, 'o-', color='#2196F3', linewidth=2)
plt.title('上半年营收趋势(万元)')
plt.xlabel('月份')
plt.ylabel('营收(万元)')
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('/tmp/chart.png', dpi=150, bbox_inches='tight')
print('Chart saved to /tmp/chart.png')pip3 install yfinanceimport yfinance as yf
ticker = yf.Ticker("AAPL")
info = ticker.info
print(f"Apple stock price: ${info.get('currentPrice', 'N/A')}")- Python: 3.13 (macOS) or system Python 3.x (Linux)
- Shell: zsh (macOS) / bash (Linux)
- Execution: local process, full filesystem access
- Networking: full internet access via
requests,curl, etc. - Session state: variables do NOT persist between separate calls — use files to pass data across steps