Look, here is proof-of concept gradle-like API for declaring dependencies for Jupyter Kernel:
https://github.com/Kotlin/kotlin-jupyter/pull/382. I think I would like something like this for general scripting as well. The aim is to unify the way dependencies are loaded in different environments. There is a problem though. Regular script does not have staged compilation, so either one needs to use gradle-like hacks with ahead-of-time block evaluation, or a separate file with dependencies.