Hacker News new | past | comments | ask | show | jobs | submit login

The greatest feature for this is inline deps, something very rare to have built-in (I've only found Deno to have a similar feature): https://bundler.io/guides/bundler_in_a_single_file_ruby_scri...





Many languages have a third-party way of doing it and a few even have first-party support, see https://dbohdan.com/scripts-with-dependencies

Since that document, Python PEP 723 was approved, see https://peps.python.org/pep-0723/ and https://packaging.python.org/en/latest/specifications/inline...

Similarly, Rust RFC 3502 was approved and an unstable implementation is available, see https://rust-lang.github.io/rfcs/3502-cargo-script.html


Also been loving that Nix can give you this for shell scripts, e.g.:

  #!/usr/bin/env nix-shell
  #!nix-shell -i bash -p cowsay imagemagick

  identify "$1" | cowsay
https://nixos.wiki/wiki/Nix-shell_shebang

Nix fan here too. If you like nix-shell, you'll love cached-nix-shell!: https://github.com/xzfc/cached-nix-shell

Elixir also has inline dependencies in scripts, via `Mix.install`: https://hexdocs.pm/mix/1.17.1/Mix.html#install/2. I've used it quite a bit, it works great.

Didn't know about this, very useful!

Yay I’m glad someone else knows about this and thinks it’s awesome too :) It’s crazy I didn’t find it until I was digging through bundler docs looking for something completely unrelated

for Scala there's Ammonite which can do this https://ammonite.io/#MagicImports

All browsers implemented it before deno with ESM and importmap.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: