Skip to main content
Version: 13 - TBD

Code formatting

Engine can automatically format the Python in your script bodies so that a workspace keeps a single, consistent code style. Formatting applies to the scripts of flows, wrappers and schedulers, and uses ruff format (a Black-compatible formatter).

Formatting only ever changes layout — indentation, spacing, quote style, line breaks. It never changes what the script does.

Formatting modes

A workspace-wide configuration option, PYTHON_AUTOFORMAT_MODE, controls how formatting is offered. It has three values:

ModeBehaviour
manualScripts are saved exactly as written. A Format action in the code editor reformats the current script on demand. This is the default.
alwaysEvery script save is reformatted before it is persisted, through any write route — the Console, the REST API and git sync.
disabledNo formatting is offered: scripts are saved as written and the editor shows no Format action.

Set the mode under the workspace configuration (see Workspace configuration options).

The Format action

In manual mode, the code editor for a Python script field shows a Format button alongside the other editor controls. Clicking it reformats the current editor content in place. The change is applied to the editor's edit history, so a single undo reverts it, and it is saved only when you save the record like any other edit. If the script is already formatted, the editor reports that no change was needed.

The Format button appears only for editable Python script fields. It is not shown on read-only content (for example a finished execution's script) or when the mode is always (where saves are formatted automatically) or disabled.

Handling of scripts that cannot be parsed

A script that Python cannot parse — for example one that is mid-edit or contains a syntax error — is left exactly as written rather than rejected. This holds for both the always mode save path and the manual Format action, so formatting never blocks a save or discards your work.

Learn More

Flows
Linting, Code Completion & Intellisense
Workspace configuration options