Image 2021 05 24 T10 16 16

Truly standalone Scala scripts by Przemek Pokrywka

Image 2021 05 24 T10 16 16

Let’s face it: if you want to quickly hack a script for use by somebody else, Scala is rarely the first choice.

Unlike Bash and Python, the essential dependencies (Java Virtual Machine, Ammonite) are usually missing on the target operating systems. This leaves you with a dilemma: should you instruct your users to install the missing bits or should you ship something, that they’ll run instantly (Bash, Python)? I think this is one of the reasons, why most of the common helper scripts is not being written in Scala. That is a shame.

TSK - The Scripting Kit ( aims to change that. With TSK you can create a Scala script that is instantly self-installable-and-executable after you save it and set the executable bit. You achieve that by prepending your Scala code with a special preamble, which consists of shell commands disguised as a Scala comment. You end up with something that works on multiple systems from the get-go and is nicely editable with IDEs at the same time. A scripting nirvana!

This talk was given by Przemek Pokrywka at Scala Love in the City, hosted by Signify and Konfy.