Skip to main content

Local Development

Although Windmill has an IDE, you can also develop & deploy locally.

Getting Started

To get started with local development and use git to version your scripts.

  • Install the Windmill Cli
  • Create a new working directory for your repository
mkdir myworkspace
cd myworkspace
  • Initialise your git repo
git init .
wmill workspace add myworkspace [workspace_id] [remote]
  • Now sync your workspace and pull your code from the remote workspace
wmill sync pull

Deno / Bun

Windmill Deno & Bun scripts can be run like normal scripts. To add testing or debugging code, add this snippet to your file:

if (import.meta.main) {
// Add your testing & debugging code here.

You can then use your script like normal (for example, deno run -A --watch my_script.ts / bun run --watch my_script.ts), and even write tests inside.

If you'd like to tweak the client settings more directly, use:

wmill.setClient(<TOKEN>, <API BASE URL>)

On import, the wmill client does the following:

Deno.env.get('WM_TOKEN') ?? 'no_token',
Deno.env.get('BASE_INTERNAL_URL') ?? 'http://localhost:8000'

which is why we recommend setting those environment variables in the sections below.

For more information on Deno & Bun development in general, see their official doc: Deno, Bun.


Windmill python scripts can be run like normal python scripts. To add testing or debbug code, add this snippet to your file:

if __name__ == 'main':
# Add your testing & debugging code here.

You can then run your script: python -m f/folder/my_script and even write tests inside.

For more information on python development in general, see the official docs

Interacting with Windmill locally

Often you will need to test a script locally that also interacts with Windmill. For example to retrieve resources.

To do so you will need to fill out the context variables that will otherwise be filled out by the Windmill runtime for you. The most important ones are WM_TOKEN, WM_WORKSPACE and BASE_INTERNAL_URL. Set BASE_INTERNAL_URL to the URL of you Windmill instance, for example, note that you can never include a trailing /, or the client will fail to connect. Then set WM_TOKEN to a token, either create this in the UI, or use wmill, the CLI using wmill user create-token. And then WM_WORKSPACE corresponds to your workspace id. Below are some examples on how to do this in various environments.


To use the getState and setState functions, you will have to set WM_STATE_PATH. We recommend using your script path name as the state path, for example:

let fullUrl = import.meta.url;
let pathS = fullUrl.substring(8, fullUrl.length - 3).split('/');
const path = pathS.slice(pathS.length - 3, pathS.length).join('/');
Deno.env.set('WM_STATE_PATH', path);


On UNIX platforms you can simply do BASE_INTERNAL_URL= WM_TOKEN=ThisIsAToken deno run -A my_script.ts with the relevant info provided, the same will work for python.

On windows this is not possible, you will have to use set. For example:

set "WM_TOKEN=ThisIsAToken"
set "WM_WORKSPACE=workspace_id"

then simply run the relevant command for your language.


The easiest way to do this is using a launch.json. See how to create one for python and deno.

Then add environment files using the "env" section in your configuration.


Make sure you are not checking your Token into git.

To easily manage your secrets it may be easier to use a .env file, and add it to .gitignore, this is also done below.

For example, for TypeScript:

"version": "0.2.0",
"configurations": [
"name": "Deno",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${file}"],
"env" {
"WM_TOKEN": "ThisIsAToken",
"WM_WORKSPACE": "workspace_id"
"envFile": ".env"

The same env & envFile options are also supported by python.

JetBrains IDEs

Especially for python you may prefer using a JetBrains IDE. Simply navigate to your run config and add two lines

WM_TOKEN = ThisIsAToken
WM_WORKSPACE= workspace_id

Make sure you are not checking your Token into git.

Pushing your scripts to Windmill

Once you are done developing your script, you can push it to Windmill using the CLI!

Be sure to add wmill to your path after installing.

deno install --unstable -A
wmill workspace add
wmill sync push