yamlscript

2024-04-29T13:02:14.527989Z

Is there any example code of using external libraries in yamlscript?

Ingy döt Net 2024-04-30T11:13:49.659819Z

I have an example of using a babashka Pod from YS. I'll see if I can find it.

Ingy döt Net 2024-04-30T11:35:03.368989Z

Here's an example of using a bb Pod in ys:

$ cat pod-test.ys 
!yamlscript/v0

use-pod: \'org::babashka/go-sqlite3 "0.2.3"

require pod::babashka::go-sqlite3: => sqlite

say:
  sqlite/query:
    .":memory:"
    ["SELECT 41 + 1 AS sum"]
The pod is autoinstalled on first run:
$ ys pod-test.ys 
Downloading pod org.babashka/go-sqlite3 (0.2.3)
Successfully installed pod org.babashka/go-sqlite3 (0.2.3)
[{:sum 42}]
And then subsequently:
$ time ys pod-test.ys 
[{:sum 42}]

real    0m0.040s
user    0m0.014s
sys     0m0.028s

Ingy döt Net 2024-04-30T11:37:10.152479Z

I want to spend more time on making it even easier to use external libraries and pods. @danielmartincraig if you (or anyone) has specific needs, let me know. It's always good to have a "customer" driving implementation.... 🙂

2024-09-25T01:16:40.814079Z

I have a pod that I'm developing, called graph-rag-pod In bb I can load it like so: (babashka.pods/load-pod "build/graph-rag-pod.js") Is there an equivalent in ys?

🙌 1
2024-09-25T01:18:31.845629Z

use-pod: "build/graph-rag-pod.js"
I'm trying this but getting Error: Wrong number of args (1) passed to: ys.std/use-pod

Ingy döt Net 2024-09-25T01:20:26.037119Z

(defn use-pod [pod-name version]
  (ys/load-pod pod-name version))

2024-09-25T01:26:43.167049Z

Is there a way to call babaska’s load-pod? Or does use-pod support pods from my local file system?

Ingy döt Net 2024-09-25T01:27:24.671469Z

I haven't looked at pods since april tbh

Ingy döt Net 2024-09-25T01:27:50.267029Z

is this public code?

2024-09-25T01:28:18.568809Z

It’s not ( yet)

Ingy döt Net 2024-09-25T01:29:54.705579Z

give me a minute

Ingy döt Net 2024-09-25T01:31:14.581669Z

try pods/load-pod('build/graph-rag-pod.js')

2024-09-25T01:40:11.504459Z

OK I'll try that, thanks!

Ingy döt Net 2024-09-25T01:48:11.361009Z

let me know if it works or not

2024-09-25T01:53:22.005909Z

I'm doing this, but I see an error:

#!/usr/bin/env ys-0

pods/load-pod('../.esbuild/.build/src/graph-rag-pod.js')

require pod::swacorp::graph-rag-pod: => grp

say: "hello"
this is the error:
Error: mapping values are not allowed here
 in reader, line 5, column 36:
    require pod::swacorp::graph-rag-pod: => grp
                                       ^
{:eval [], :debug-stage {}}

Ingy döt Net 2024-09-25T01:54:14.822459Z

when you can share the code I can look into it

2024-09-25T02:01:44.877459Z

thanks. I'm still learning to navigate the process for releasing open source stuff here so it may not be soon that I'm able to share

Ingy döt Net 2024-09-25T02:03:48.335689Z

you can also try to make a repro of the problem with some other pod

2024-09-26T03:10:40.665189Z

I don't have a repro to share, but I can report that the following seems to work:

graph-rag-pod =: pods/load-pod('../.esbuild/.build/src/graph-rag-pod.js')
require pod::swacorp::graph-rag-pod: => grp
say: "hello"

Ingy döt Net 2024-09-26T03:12:51.808739Z

That's good. I'll try to revisit pod usage this weekend

Ingy döt Net 2024-09-26T03:13:15.253009Z

trying to get 0.1.77 out which has a ton of cool new stuff

🎉 1
2024-04-29T13:02:33.766199Z

Thanks for the response on my GH issue

👍 1