What runs where¶
pp decides where each command runs. The rule is short:
- Cloud for anything that elaborates Lean or touches build state. This is the default, including for subcommands ProofPod has never heard of.
- Your machine for commands that scaffold files without elaborating anything, print help, or are tied to your editor, credentials or display.
- Both for commands whose purpose is to reset state that exists on both sides.
You can always ask:
$ pp explain lake clean
lake clean runs on this machine and in the cloud
because it removes build outputs, which exist both locally and in the cloud.
The table¶
lake¶
| Command | Runs | Notes |
|---|---|---|
lake build, lake query |
Cloud | |
lake test, lake lint, lake check, lake check-build, lake check-test, lake check-lint |
Cloud | The check-* commands load the workspace, which would otherwise clone your dependencies locally. |
lake exe <exe>, lake env <cmd>, lake lean <file> |
Cloud | Arguments after the wrapped command are passed through. |
lake run <script>, lake script run, lake scripts |
Cloud | |
lake update |
Cloud | The updated lake-manifest.json and lean-toolchain are copied back to your machine. |
lake shake, lake pack, lake unpack, lake comparator |
Cloud | Source files a command rewrites are copied back. |
lake cache get, lake cache put, … |
Cloud | |
lake exe cache get |
Cloud | Finishes immediately: Mathlib is already built in the environment. |
lake clean |
Both | See Cleaning and caches. |
lake cache clean |
Both | |
lake new, lake init |
Local | Creates files in your working directory. |
lake translate-config |
Local | Rewrites your lakefile. |
lake serve |
Local | The language server talks to your editor. |
lake upload |
Local | Needs your GitHub credentials. |
lake samply |
Local | Opens a profiler UI on your machine. |
lake help, lake --help, lake --version, lake <cmd> --help |
Local | |
| anything else | Cloud | New Lake subcommands work without a ProofPod update. |
lean¶
| Command | Runs | Notes |
|---|---|---|
lean File.lean |
Cloud | |
lean --run File.lean args… |
Cloud | Add pp --stdin if the program reads standard input. |
lean --stdin |
Cloud | Standard input is forwarded automatically. |
lean -o out.olean File.lean, --deps, --json, … |
Cloud | Output files appear locally through sync. |
lean --server, lean --worker |
Local | Editor integration. |
lean --version, --help, --print-prefix, --print-libdir, --githash, --features |
Local | These describe the local installation. |
Why cloud is a safe default¶
Running an arbitrary command somewhere else is only safe if its effects come
back. ProofPod syncs in both directions: after a cloud command, any source file
it created, changed or deleted is applied to your working tree. That is what
lets pp lake update leave you with an updated manifest, and pp lake exe
mk_all or pp lake shake --fix leave you with rewritten sources, exactly as
if they had run locally.
Build outputs (.lake/) are the exception. They stay in the cloud on purpose:
they are large, and they are the thing you are paying ProofPod to hold.
When Lean is not installed locally¶
Commands in the Local rows need lean or lake on your machine. If they are
missing:
- Commands that only produce files or text (
lake new,lake init,lake translate-config, help and version output) run in the cloud instead and their results are synced back. - Commands that are inherently local (
lake serve,lean --server,lake upload,lake samply) fail with a message explaining why.
Overriding the decision¶
$ pp --local lake build # run on this machine, whatever the command
$ pp --cloud lake new foo # run in the cloud, whatever the command
What "runs in the cloud" means in detail¶
- Working directory. The command runs in the cloud copy of the directory you are in. Running from a subdirectory of your project works.
- Arguments. Everything after
leanorlakeis passed through byte-for-byte, including--,-hand elan's+toolchainprefix. - Output. stdout and stderr are streamed as they are produced and stay
separate, so
pp lake build > out.txt 2> err.txtbehaves as expected. When both are terminals, the command runs under a pseudo-terminal so Lake's progress display looks the same as it does locally. - Exit code.
ppexits with the command's exit code. Failures of ProofPod itself use 125; see the CLI reference. - Standard input. Not forwarded unless you ask. See Standard input below.
- Ctrl-C. Cancels the cloud command. Press it twice to stop waiting immediately.
- Environment variables. The command gets a clean environment. Pass
variables with
pp --env KEY=VALUEor an[env]table inproofpod.toml.
Standard input¶
By default pp does not read standard input at all, and the cloud command sees
an empty one. This is deliberate. A cloud command cannot simply inherit your
stdin the way a local process does; pp would have to read it on the
command's behalf, and doing that uninvited breaks two ordinary situations:
- Scripts and tools that leave stdin open. CI runners, agent harnesses and
subprocess.Popen(stdin=PIPE)hand a command a pipe that never closes. Waiting for it would hang forever, for a command (lake env lean File.lean) that never wanted input. - Loops. In
while read f; do pp lake env lean "$f"; done < files.txt, reading stdin would swallow the rest offiles.txtand end the loop after one iteration. This is the classicsshpitfall.
So forwarding is opt-in, like docker run -i:
$ cat input.txt | pp --stdin lake exe mytool # -i for short
$ pp --stdin lean --run Main.lean < input.txt
The one exception is lean --stdin, where the command line itself says the
input is on stdin:
When forwarding, pp reads standard input to the end before the command
starts, so input is not interactive. Up to 64 MiB is accepted.
Running in the background¶
$ pp --detach lake build
run-19f3a2c4d5e6f7a
$ pp logs -f run-19f3a2c4d5e6f7a
$ pp cancel run-19f3a2c4d5e6f7a
A detached command keeps running after you close the terminal. Source files it changes are not synced back automatically, since nothing is waiting for it.