write-script-python3

Writes and tests Windmill Python scripts with correct CLI preview, metadata sync, and SDK usage.

1|Updated Aug 3, 2026
One-click install
npx skills add https://github.com/vpzed-dev/smithy --skill write-script-python3-vpzed-dev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: write-script-python3
Source: https://github.com/vpzed-dev/smithy/tree/main/windmill/local-dev/.agents/skills/write-script-python3
Command: npx skills add https://github.com/vpzed-dev/smithy --skill write-script-python3-vpzed-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Python scripts for the Windmill platform involves platform-specific conventions — a required main function, TypedDict resource types, lock files, and content hashes — that are easy to get wrong, and it is easy to accidentally deploy untested code when you only meant to preview it. ## Core Features & Use Cases - Correct CLI workflow: Distinguishes wmill script preview (test local edits) from wmill script run (deployed version) and wmill sync push (deploy), so untested changes never overwrite the workspace. - Metadata synchronization: Runs wmill generate-metadata after edits that change imports or main arguments, keeping .lock, .script.yaml, and wmill-lock.yaml hashes consistent. - Platform conventions: Enforces the main function structure, lowercase TypedDict resource types, preprocessor script signatures, S3 object operations, and the full wmill Python SDK surface (jobs, variables, resources, state, approvals, S3, DuckDB/DuckLake). - Use Case: Ask the agent to write a Python script that queries a PostgreSQL resource and loads results to S3; it produces a compliant script, previews it with sample args, and regenerates metadata before any deploy. ## Quick Start Write a Windmill Python script that fetches data from an API and stores the result, then preview it with sample arguments.

Frequently Asked Questions about write-script-python3

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test a Windmill Python script locally without deploying?▼

Use `wmill script preview <script_path>` to run the local file without deploying it to the workspace. Pass sample arguments with `-d '<args>'`. Only use `wmill script run` when you explicitly want to execute the already-deployed version.

How do I write a Python script for Windmill?▼

Define at least one function named `main` with typed parameters; do not call it yourself. Declare any needed credentials as lowercase TypedDict resource types before `main`, and import the `wmill` client for platform interactions like variables, resources, and S3.

Why does wmill-lock.yaml show diffs after editing a script?▼

Editing a script's content, especially adding imports or changing `main`'s arguments, invalidates its recorded content hash. Run `wmill generate-metadata` to regenerate the `.lock`, `.script.yaml` schema, and hash entries so git-sync and CI stay clean.

How do I pass database credentials to a Windmill Python script?▼

Define a TypedDict with the resource fields (host, port, user, password, dbname) in lowercase before `main`, then add it as a parameter. Windmill injects the resource value at runtime; the type name must stay lowercase even if an import conflicts.

Can a Windmill Python script read and write S3 files?▼

Yes. Type a parameter as `S3Object` from the `wmill` package, then use `wmill.load_s3_file` or `load_s3_file_reader` to read and `wmill.write_s3_file` to write. Helpers also exist for signing objects and generating presigned public URLs.