Run calculations with run_python
Ask for reproducible numerical work and inspect its code, files and limits.
Ask for the calculation#
Loupist uses its built-in calculation tools for supported operations and run_python for custom numerical work. You ask in Chat; you do not need a shell or a separate Python installation.
Example prompt using invented inputs:
Use run_python to calculate the margin from revenue of 100
and operating profit of 20. Show the code, assumptions and result.
Save a small CSV in outputs/ so I can inspect it.The arithmetic below is an example, not a company figure:
from pathlib import Path
import pandas as pd
revenue = 100
operating_profit = 20
margin_pct = operating_profit / revenue * 100
Path("outputs").mkdir(exist_ok=True)
pd.DataFrame([{"margin_pct": margin_pct}]).to_csv(
"outputs/margin.csv", index=False
)
print(margin_pct)Inspect what ran#
- Expand the answer's work receipt and open Ran Python.
- Read the code and output. Check units, period and inputs.
- Open the resulting workspace file or Work item beside Chat.
- For source-based figures, inspect the linked input evidence too. Running code alone does not retain an original as a Source.
A code block in an answer is not evidence it ran. Look for the actual completed step and saved output.
Offline runtime#
Python runs in a pinned offline runtime. It has no shell, network, DNS, process spawning or host environment. The numerical packages include numpy, pandas, scipy, matplotlib, statsmodels and scikit-learn. It cannot download a missing package.
The default timeout is 60 seconds, up to 120 seconds. Guest memory is bounded at 512 MiB. Large workspaces can produce a partial file snapshot; the result reports omissions. Split work or provide a smaller input if needed.
Files and cancellation#
Attachments are read-only. Top-level workspace files are read-only to Python; allowed writes include outputs/ and admitted workspace subfolders. The app checks copy-back destinations and avoids overwriting a host file changed during the call.
Based on the app’s source documentation and English interface labels. Report a docs issue.