> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lazycloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# deploy, run, serve, shell, dev

> Deploy apps, call a function once, run a live preview, and open remote shells.

[Develop, test, deploy](/concepts/workflow) explains when each command fits and
where calls go. None of these commands override a workload's configuration,
which comes only from its decorator or constructor.

## lazycloud deploy

```bash theme={null}
uv run lazycloud deploy HANDLER [HANDLER ...] [options]
```

Deploys one workload or a whole app, chosen by
[handler reference](/cli/overview#handler-references):

```bash theme={null}
uv run lazycloud deploy quickstart           # the module's only app
uv run lazycloud deploy myproject.api:app    # one app in a module
uv run lazycloud deploy quickstart:hello     # one workload
```

The deployment name comes from the workload's `name=`. `--source-root <dir>`
uploads a different directory. A failure stops the command and leaves what
already deployed in place.

```bash theme={null}
uv run lazycloud deploy page_stats.api --diff
uv run lazycloud deploy page_stats.api --diff --prune
uv run lazycloud deploy page_stats.api -p
```

`--diff` lists each workload as `add`, `redeploy`, `retain`, or, with `--prune`,
`remove`, without uploading or changing anything. It doesn't compare source or
configuration, and it still imports your modules. `--prune`, or `-p`,
[removes workloads](/concepts/apps#remove-workloads) the code no longer
declares. Several references deploy separate complete apps together.

## lazycloud run

```bash theme={null}
uv run lazycloud run HANDLER [ARGS]... [options]
```

Calls a function once in the cloud from your working tree, with no deploy, and
prints the result. JSON arguments become Python values, and anything else stays
a string:

```bash theme={null}
uv run lazycloud run quickstart:hello LazyCloud
uv run lazycloud run reports:summarize_sales '[1200, 3500, 800]'
```

Arguments are positional, so lists and objects need quotes. A pod handler
starts an instance with the given command, and a plain Python callable runs
locally. Logs go to stderr and the result to stdout. `--json` needs a
JSON-compatible result, and `--output result.pkl` saves any result to a file.

## lazycloud serve

```bash theme={null}
uv run lazycloud serve HANDLER [--timeout <seconds>] [--sync-dir <dir>]
```

Runs a function, endpoint, or ASGI app as a
[live preview](/concepts/workflow#live-preview) until Ctrl+C, or until
`--timeout` seconds pass. Each edit syncs only the changed files. `--sync-dir`
syncs a directory other than the current one. The Python form:

```python theme={null}
from page_stats import analyze

analyze.serve(sync_dir=".")
```

Functions, endpoints, ASGI apps, and apps all have `.serve()`.

## lazycloud shell

```bash theme={null}
uv run lazycloud shell HANDLER [--sync-dir <dir>] [options]
uv run lazycloud shell --container-id <id>
```

Opens an interactive shell in the handler's image, or attaches a shell to a
running container.

## lazycloud dev

```bash theme={null}
uv run lazycloud dev [HANDLER] [--sync <dir>] [options]
```

Opens a shell in a remote container with your working directory synced in, for
iterating without a deploy. `--sync` defaults to `./`. Without a handler, `dev`
uses the managed Python image with default resources. A GPU or custom image
comes from a workload defined in code and passed as the handler.

<Note>
  To change your default workspace, run `uv run lazycloud workspace use <name>`.
  Commands with a `--workspace` option can override it for one call.
</Note>
