Inline dependency version definitions for scripting. #22112
borissmidt
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
An example case:
In the devops world it is common to have yaml configs. But not many languages a yaml module out of the box.
This then forces you to use bash + yq and hope that other developers have it installed.
With python its also possible but then you need to make sure a 'virtual env' is made of that script.
In many CI cases the checks are only really relevant to a single project but it would be really nice not to port the exact enviroment everywhere, So as a proposal i have to directly state the import version in the main script. Then you can just run the vlang script.
v would then download and use the correct scripts.
https://github.com/vlang/v/blob/master/doc/docs.md#cross-platform-shell-scripts-in-v
This would have the main advantage that you do not have to manage the dependencies separate from the script and have the advantage of not having to manage a separate environment for the script.
As a reference:
The scala CLI seems to have this feature but then you have to install the whole JVM to be able to run the scripts:
https://scala-cli.virtuslab.org/docs/guides/introduction/dependencies#excluding-transitive-dependencies
Here the comment includes extra packages and only the 'main' script is able to include more packages.
I understand that for a multi file project there will be conflicting version definitions and at some point the script has to 'grow up' into a real CLI tool. Maye as a solution only the 'main' script can contain the 'using' dependencies comments. Which are ignored in case it isn't a main script.
Its just an idea i had for some time but i don't see many languages do this. While they could really start competing with bash on the scripting level if they actually did.
Beta Was this translation helpful? Give feedback.
All reactions