Fork me on GitHub
#babashka
<
2023-03-24
>
benfleis09:03:05

practically speaking, what’s the difference between declaring :pods {babashka/fs …} vs the same decl in :deps? AFAICT the pods directive is broader, allowing non-clojure, proto-following things, but for plain-ole clojure pods, are there other differences? [edit: I misunderstood that the same code can trivially be loaded in either place, confusing fs and fswatcher when scanning]

judepayne12:03:21

Hi, have encountered a bit of an issue with transitive pods. I have two local projects. The first depends on a pod (sqlite-3) which I require in the 'new' way by specifying in under the :pods key of bb.edn and then requiring in my ns. So far so good. The second project has the first as a dependency. When in the second project, I require the ns from the first that uses the (sqlite) pod, I encounter an error message about pod not loaded. If I then go back to the first project and specify the pod the 'old' way, by requiring pods, then explicitly loading the pod then requiring it, and jack in again to my second project, I can require the njust fine. Is this an issue? happy to raise it.. or is it known?

borkdude12:03:01

@U121T48Q6 For transitive usage of the pod, declaring it in bb.edn doesn't work. Just use load-pod manually in libraries

judepayne12:03:26

Will make the switch. thanks

borkdude12:03:07

There is an issue for this to improve this for dependencies, but it isn't quite there yet

borkdude12:03:37

For now I think building a library around a pod, like I did with clj-kondo-bb is the least worst option

judepayne13:03:47

I will have a look at that example.

judepayne13:03:34

What's the purpose of the deps.edn with just {} in it? Is this so that it can be resolved as a dependency by clojure?

staypufd22:04:00

@U04V15CAJ Is this:point_down::skin-tone-2: called out in the Babashka book?

What's the purpose of the deps.edn with just {} in it? Is this so that it can be resolved as a dependency by clojure?

borkdude06:04:45

Please make an issue at the book's repo, then I'll make an attempt to clarify it

sb15:03:11

I would like to understand how works pods. The example project works fine. But at my case.. not really 🙂

#!/usr/bin/env python3

import sys
import imageio


def main(sourcefile, targetfile):
    img = imageio.imread(sourcefile)
    imageio.imwrite(targetfile, img)
    return "success"


if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(f"Usage: {sys.argv[0]} <sourcefile> <targetfile>")
        sys.exit(1)

    sourcefile = sys.argv[1]
    targetfile = sys.argv[2]

    result = main(sourcefile, targetfile)
    print(result)

sb15:03:22

#!/usr/bin/env bb

(require '[babashka.pods :as pods])

(pods/load-pod ["./pod-ico.py"])

sb15:03:52

Error message

./ico-creator.clj -debug
----- Error --------------------------------------------------------------------
Type:     java.io.EOFException
Message:  Invalid netstring. Less data available than expected.
Location: /Users/..path../ico-creator/./ico-creator.clj:5:1

----- Context ------------------------------------------------------------------
1: #!/usr/bin/env bb
2: 
3: (require '[babashka.pods :as pods])
4: 
5: (pods/load-pod ["./pod-ico.py"])
   ^--- Invalid netstring. Less data available than expected.

sb15:03:33

What is the problem? (lispclouds sqlite example run correct way).. maybe the 2 params at main?

borkdude15:03:27

@U2T2ZEVPC how is your program supposed to be invokable as a pod? the pod must implement a protocol which means it sends specific messages back and forth via stdin/stdout

sb16:03:14

@U04V15CAJ thanks! I don’t understand that before this. So stdin/stdout. I test it.

borkdude16:03:44

It would be good to read the docs first: https://github.com/babashka/pods

😉 2
💯 2
sb16:03:04

true 😄