Scripting
You can use pkgx as the shebang for your scripts:
#!/usr/bin/env -S pkgx [email protected]
import sys
print(sys.version)$ chmod +x ./my-script.py
$ ./my-script.py
3.9.17Including Additional pkgs
Scripts are the glue that allows open source to be composed into powerful new
tools. With our +pkg syntax you make anything in open source available to your
script.
#!/usr/bin/env -S pkgx +openssl deno run
Deno.dlopen("libssl.dylib")Scripting for Various Languages & Their Dependencies
Python
Use uv to import PyPi dependencies:
Ruby
Use Bundler:
JavaScript & TypeScript
Use Deno:
Rust
[!TIP] Probably you should specify a more precise Rust version as a plus-pkg arg.
Go, C, C++, etc
Use Scriptisto:
Mash
We think pkgx scripting is so powerful that we made a whole package manager to
show it off.
Other Examples
We make use of pkgx scripting all over our repositories. Check them out!
Ultra Portable Scripts
Requiring a pkgx shebang is somewhat limiting. Instead you can use our cURL
one-liner coupled with +pkg syntax to temporarily install pkgs and utilize
them in your scripts:
Last updated