CLI
The pivotal command is installed automatically with pip install pivotal-lang.
Run a .pivotal file
Execute a Pivotal source file directly:
Tables are computed and any show, plot, or table statements produce output. The script runs in a fresh Python namespace with pandas available.
Equivalent to:
Compile to Python
Compile a .pivotal file to a .py file:
The output file contains the generated pandas code with import pandas as pd at the top. Edit and run it independently of Pivotal.
Export a notebook to Python or SQL
Convert a Jupyter notebook's %%pivotal cells to code:
Specify a different backend:
pivotal --export-py analysis.ipynb --backend duckdb
# creates analysis.py with DuckDB code
pivotal --export-py analysis.ipynb --backend sql
# creates analysis.sql
%%pivotalcells are compiled to the target backend- Regular Python cells are included as-is (except for
sqlbackend) - GUI cells are skipped
Export a notebook to .pivotal
Convert a Jupyter notebook to a standalone .pivotal file:
%%pivotalcells → written as DSL source- Python cells → wrapped in
python...endblocks - GUI cells → skipped
The output file is a valid .pivotal file that can be run with pivotal analysis.pivotal or opened in VS Code.
Summary
| Command | Output | Description |
|---|---|---|
pivotal file.pivotal |
(runs) | Execute a .pivotal file |
pivotal --compile file.pivotal |
file.py |
Compile to pandas Python |
pivotal --export-py nb.ipynb |
nb.py |
Export notebook to Python |
pivotal --export-py nb.ipynb --backend duckdb |
nb.py |
Export notebook with DuckDB |
pivotal --export-py nb.ipynb --backend sql |
nb.sql |
Export notebook to SQL |
pivotal --export-pivotal nb.ipynb |
nb.pivotal |
Export notebook to Pivotal DSL |