Scripting on the JVM with Java, Scala, and Kotlin
3 points by chad
3 points by chad
I thought Groovy is the usual scripting language on the JVM.
It's used for configuring gradle builds but I don't think it gets much use in general purpose scripting.
But the whole point of this article is why you might want to use more general purpose languages to write your single-file small scripts instead.
We briefly tried using Kotlin scripting at work and I'm not sure there are a lot of benefits. It doesn't really lend itself to it, and (imho) if you need to have something fetching your deps working for you already lose half the benefit.
I rewrote a buggy bash script (ha, recurring motive) in python today. Yes it's longer, but it's self-contained and I can copy it from my work mac to any linux box I own with a python that's younger than 5-7 years (pathlib).
In the past when I've wanted to replace bash scripts with python it seems like such a sensible choice until you need a dependency (usually requests). So you're stuck between either sticking to the stdlib or having a full blown project with a virtualenv and dependencies, etc. instead of just a single file.
I believe uv has some tooling similar to what mill does in the link.
urllib is not as usable as requests, but I have written quite a few scripts using it and it's not very high on my list of annoyances with dependency less Python scripts. (Having to write subprocess wrappers is by far the biggest.)