Python Script Execution
Zetten allows you to run Python functions directly, bypassing the need for separate shell scripts or python -m commands.
Configuration
Use the script key in your [tasks] definition.
[tasks.hello]
description = "Run a greeting function"
script = "my_module:greet"
This is equivalent to running:
python -c "import my_module; my_module.greet()"
Inline Modules
You can also run modules directly:
[tasks.server]
script = "http.server"
Equivalent to: python -m http.server
Why use script over cmd?
- Cross-Platform: no need to worry about
/vs\or shell differences. - Performance: slightly faster startup as it avoids shell process overhead.
- Cleanliness: keeps your config focused on Python logic.