grab
grab statement for importing Nimble packages, similar to Groovy's Grape
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-27 04:30 |
Tags
Installation
nimble install grab
choosenim install grab
git clone https://github.com/metagn/grab
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| grab | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/metagn/grab |
|---|---|
| Homepage | https://github.com/metagn/grab |
| Registry Source | nimble_official |
README
Disclaimer
Does not seem to work properly with Nim 2.0+ for packages with dependencies, likely a limitation of the new Nimble path handling. Compiling a second time works though.
grab
Adds a grab statement for installing and importing Nimble packages
directly through Nim code, similar to Groovy's Grape and @Grab. Works
with NimScript, as all the computation is done at compile time.
This installs the package globally, and can affect compilation time. For this reason it should generally only be used for scripts, tests, snippets and the like.
import grab
# install the package `regex` if not installed already, and import it
grab "regex"
assert "abc.123".match(re"\w+\.\d+")
# run install command with the given arguments
grab package("-y https://github.com/arnetheduck/nim-result@#HEAD",
name = "result", forceInstall = true): # clarify package name to correctly query path
# imports from the package directory
import results
func works(): Result[int, string] =
result.ok(123)
func fails(): Result[int, string] =
result.err("abc")
assert works().isOk
assert fails().error == "abc"
Install with:
nimble install grab