Fork me on GitHub
Oliver Marks06:02:29

I am trying to package bb I have just packaged jet and clj-kondo but running script/uberjar in the repo gives me an error. Execution error (FileNotFoundException) at babashka.impl.xml/eval181$loading (xml.clj:1). Could not locate sci/core__init.class, sci/core.clj or sci/core.cljc on classpath. Is there some prerequisit I am missing I woul have expected lein to pull sci ?


Oh yes, you also need to pull submodules


ah that may complicate things using the tar.gz release at present will have to do a bit of research to see if thats a thing in the context of a build


what are you trying to do, can you give more info?


building linux packages basically, they usesually want a source release which you checkout and build from


I think it can use git directly, just need to find out if I can pull the submodules as part of that


it may be I can just run a git command after to pull those in outside the initial pull


you can do it in one go


git clone  --recursive


or do it a second step.


yeah I am doing a bit of googling thats for clj-kondo you specify a source location to fetch from


sure I can find a way around it though now I know thats needed


package.yaml being the main file

Oliver Marks19:02:14

cheers for the help earlier, with a bit of luck babashka should pop up in solus this week along with jet and clj-kondo 🙂


I think this self-contained executable approach could also work for babashka:;t=1186s&amp;ab_channel=LeandroFacchinetti You would package babashka itself + your project in its own executable and then you could deploy it. The author is using a golang stub and a tarball of the project which extracts itself at runtime to implement it.


Documented producing a self-contained executable on the wiki:

🚀 3

Hello, there. First thanks a lot for your work! it's awesome. I have a log file already there, and the two processes below should append to that log file. I try to launch some long living processes which should append to an existing (log) file (so I'd like them non blocking). I found no way to do that. Thanks in advance

(p/process ["npm" "install"]
             {:out :inherit :err :inherit :dir "app"})
(p/process ["npx" "shadow-cljs" "watch" "app2"]
             {:out :inherit :err :inherit :dir "app2"}))


@U018QDQGZ9Q :inherit means that the stream is written to the output stream of the babashka process. You can use (io/file "output.txt") instead to write the output to a file.


I got this, but with`io/file`, I found no append option. I tried the example below and it did not work, I only have the last file output in it. Moreover, I'd like to append to an existing file:

(let [f (io/file "output.txt")]
    (p/process ["npx" "shadow-cljs" "watch" "app"]
               {:out f :err :inherit :dir "app"})
    (p/process ["npx" "shadow-cljs" "watch" "app"]
               {:out f :err :inherit :dir "app"}))


ah I got it. let me figure out a workaround. We should really add an option for this in process.


(doto (:pb (p/pb ["npx" "shadow-cljs" "watch" "app"]
                 {:err :inherit :dir "app"}))
    (io/file "/tmp/log.txt")))


But I will add better support for this


Yes, I've just tested it and it perfectly fit in my use case !!!! thanks


@U018QDQGZ9Q in babashka 0.7.6 (just released) you can now do this:

👍 1
jaide22:02:53 Nothing came up when searching for Babashka so hopefully this fixes that 😅 Going to make an nbb one too.

🎉 1

So if I understand correctly, replit supports nix out of the box?


Yeah was able to use it as the base box, added babashka, clojure-lsp, and copied a bit of config for the .replit from the main clojure one


have not published yet. looks like nbb may be a bit trickier. Seems it has some custom interpreter support with their prybar library might have to try an upstream pr. Looking through the node one to see if it can be customized to run nbb at all


Thinking I'll go for the naive get-it-done approach to make it similar to the babashka one. Then can support these other features later or someone can fork it and go for it.


what exactly is the problem here?


you might have to add "type": "module" to package.json to be allowed to import nbb


since nbb as a library is an ES6 module


It's more that the node replit template supports a debugger and instead of running a command, runs an interactive console interpreter


hmm interesting


But the interpreter seems like it's mostly suited for running the languages hard-coded into that repo like prybar-clojure or prybar-nodejs


Given the clojure one, doesn't look like it would be too bad to create a PR to add languages/bb or languages/nbb but that's a bit more than I can take on atm so will set up the replit to run a nbb hello-world script like similar to the bb script, at least it will be consistent


We could embed this or at least link to this on the README of both projects


even this worked!

cli.core=> (range)
^C"Error: Script execution was interrupted by `SIGINT`"


I think I like this approach of running the repl from within the main for these. This way if you just want to start trying out some cljs then there's the repl, and if you wanted to make a script of some kind they can comment it out and start writing as they're already in the defn main


Updated the Babashka one to also run a repl in the main


Hello, I'm currently looking into porting a fairly complex bash project to babashka, is there a way to implement sort of a plugin system with bashbaska? Which plugin (namespace?) to load would be determined by a passed arg, ideally users can add their own plugins via secondary class path.


That should certainly be possible


Great. I got a little prototype that looks promising, except for the dynamic require. Any hints on how to approach this?


well, you can require dynamically using ... require :)


(require (symbol (first *command-line-args*)))


If you can share your prototype and where you are stuck, that would be easier to say something about. I'm sure there is a solution


It's almost midnight, but I'll look tomorrow


(require (symbol (first *command-line-args*)))
Tried that, it ran but I didn't get the test output from the plugin. After your comment I put a println directly in the plugin ns which confirmed the ns was actually loaded. 🙈 Turns out the problem was that I tried to execute the function symbol directly which always returned nil . After a bit of googling using did the trick.


Thank you for the awesome project btw, so nice to have Clojure on the shell. ❤️


cool! there is also a combination of require + resolve which is called requiring-resolve