Skip to main content

Scripts

Listing scripts

The wmill script list command is used to list all scripts in the remote workspace.

wmill script

Pushing a script

The wmill script push command is used to push a local script to the remote server, overriding any existing remote versions of the script. This command allows you to manage and synchronize your scripts across different environments.

This command support .ts, .js, .py, .go and .sh files.

wmill script push <path>

Arguments

ArgumentDescription
pathThe path to the local script file that needs to be pushed.

Examples

  1. Push the script located at /path/to/script.js
wmill script push /path/to/script.js

Creating a new script

The wmill script bootstrap command is used to create a new script locally in the desired language.

wmill script bootstrap [--summary <summary>] [--description <description>] <path> <language>

Arguments

ArgumentDescription
pathThe path of the script to be created.
languageThe language of the new script. It should be one of deno, python3, bun, bash, go, nativets, postgresql, mysql, bigquery, snowflake, mysql, graphql, powershell

Examples

  1. Create a new python script f/scripts/hallowed_script
wmill script bootstrap f/scripts/hallowed_script python3
  1. Create a new deno script f/scripts/auspicious_script with a summary and a description
wmill script bootstrap --summary 'Great script' --description 'This script does this and that' f/scripts/auspicious_script deno

(Re-)Generating a script metadata file

The wmill script generate-metadata command is used to read all the files that have been edited and gracefully update the metadata file and lockfile accordingly, inferring the script schema from the script content and generating the locks. Only the schema and the locks part of the metadata file will be updated. If a change was made to other fields like description or summary, it will be kept.

This command can only be run at the same level of the wmill-lock.yaml of your workspace, so by default at top level of the repository.

wmill script generate-metadata

You can also generate metadata for a single script with wmill script generate-metadata <path>:

wmill script generate-metadata [--lock-only] [--schema-only] [<path>]

Note that you can explicitly exclude (or include) specific files or folders to be taken into account by this command, with a wmill.yaml file.

Flows inline script lockfiles can be also updated locally in the same way as wmill script generate-metadata --lock-only but for flows' inline scripts:

wmill flow generate-locks

package.json & requirements.txt

When doing wmill script generate-metadata, if a package.json or requirements.txt is discovered, the closest one will be used as source-of-truth instead of being discovered from the imports in the script directly to generate the lockfile from the server.

Below is a video on how to override Windmill inferred dependencies by providing custom package.json or requirements.txt.

Arguments

ArgumentDescription
pathThe path of the script content file.

Examples

  1. After update the of the script f/scripts/hallowed_script.py, re-generate its schema and its locks:
wmill script generate-metadata f/scripts/hallowed_script.py

Showing a script

The wmill script show command is used to show the contents of a script on the remote server.

wmill script show <path>

Arguments

ArgumentDescription
pathThe path to the remote script file that needs to be shown.

Examples

  1. Show the script located at f/scripts/test
wmill script show f/scripts/test

Running a script

Running a script by its path s done using the wmill script run command.

wmill script run <remote_path> [options]

Arguments

ArgumentDescription
remote_pathThe path of the script to be run.

Options

OptionParametersDescription
-d, --datadataInputs specified as a JSON string or a file using @filename or stdin using @- . Resources and variables must be passed using "$res:..." or "$var:..." For example wmill script run u/henri/message_to_slack -d '{"slack":"$res:u/henri/henri_slack_perso","channel":"general","text":"hello dear team"}'
-s, --silentDo not ouput anything other then the final output. Useful for scripting.

CLI arguments

Remote path format

<u|g|f>/<username|group|folder>/...