Script editor
In Windmill, Scripts are the basis of all major features (they are the steps of flows, linked to apps components, or can be run as standalone).
A Script can be written in: TypeScript (Deno & Bun), Python, Go, Bash or SQL. Its two most important components are the input JSON Schema specification and the code content.
Python and Go Scripts also have an auto-generated lockfile that ensure that executions of the same Script always use the exact same set of versioned dependencies. To fit Windmill's execution model, the code must always have a main function, which is its entrypoint when executed as an individual serverless endpoint or a Flow module and typed parameters used to infer the script's inputs and auto-generated UI:
- TypeScript
- Python
- Go
- Bash
async function main(param1: string, param2: { nested: string }) {
...
}
def main(param1: str, param2: dict, ...):
...
func main(x string, nested struct{ Foo string \`json:"foo"\` }) (interface{}, error) {
...
}
There is no main needed for Bash. The body is executed and the args are passed directly.
For scripts with numerous lines of code (+1,000), we recommend splitting the logic into Flows or Sharing common logic.
Script editor features
The Script editor is made of the following features:
Workflows as code
One way to write distributed programs that execute distinct jobs is to use flows that chain scripts together.
Another approach is to write a program that defines the jobs and their dependencies, and then execute that program directly in your script. This is known as workflows as code.
Code editor features
For features specific to the Code editor, check: