Not every deployment step belongs in PowerShell.
How Python steps work
Every script step in Jaws Deploy runs under a managed runtime. Python steps work exactly like PowerShell steps: they receive the full deployment context, can read variables and packages, emit output variables, and appear in the deployment log with the same step-level and target-level visibility.
The agent provisions and caches the Python runtime on each target automatically — no manual install per machine, no version pinning in CI, and offline provisioning for air-gapped targets.
Writing a Python step
Select Run Script (Python) as the step type. The agent runs your script with the jaws module pre-imported via a bootstrap wrapper. Use jaws.parameters, jaws.packages, and jaws.set_output_value() the same way PowerShell uses $Jaws.
import jaws
# Read a deployment variable
conn = jaws.parameters.get("ConnectionString")
# Read a package path
pkg = jaws.packages.get("MyApp", {})
extract_path = pkg.get("ExtractedPath", "")
# Emit an output variable for later steps
jaws.set_output_value("DeployedUrl", f"https://{conn}/health", scope="Global")
print(f"Deployed to {extract_path}")
Script modules
Shared helper code lives in Script Modules — workspace-level libraries that any script step can import. A Python script module is a regular .py module managed by the platform. Any Python step in any project can import it and call its functions.
Use script modules to centralise connection helpers, retry logic, logging wrappers, or any function copied more than twice across your deployment processes.
# Python script module (defined once at workspace level)
# Module: deploy_helpers
import requests
def wait_for_health(url: str, retries: int = 10) -> bool:
for _ in range(retries):
try:
r = requests.get(url, timeout=5)
if r.status_code == 200:
return True
except Exception:
pass
return False
# ---
# In any Python script step — import and call it
import jaws
import deploy_helpers
url = jaws.parameters.get("HealthCheckUrl")
if not deploy_helpers.wait_for_health(url):
raise RuntimeError(f"Health check failed: {url}")
Runtime provisioning and air-gapped targets
The agent downloads and caches the Python runtime once per workspace. Subsequent deployments reuse the cached version — no network round-trip per step. For targets without internet access, the runtime can be pre-fetched and bundled with the agent install so Python steps work the same in an air-gapped environment as in a cloud-connected one.
- Runtime provisioned and cached per target on first use
- Subsequent deployments skip the download — cache is reused
- Offline / air-gapped targets use pre-bundled runtime packages
- Mix PowerShell and Python steps in one deployment process