This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-03
Channels
- # announcements (12)
- # babashka (36)
- # beginners (126)
- # calva (26)
- # cider (10)
- # clj-kondo (71)
- # cljdoc (3)
- # cljsrn (2)
- # clojure (232)
- # clojure-australia (1)
- # clojure-europe (11)
- # clojure-france (20)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-serbia (4)
- # clojure-uk (6)
- # clojurescript (62)
- # conjure (5)
- # cursive (12)
- # data-science (1)
- # datomic (57)
- # deps-new (1)
- # duct (3)
- # emacs (5)
- # events (8)
- # fulcro (6)
- # graalvm (5)
- # helix (3)
- # jobs (6)
- # jobs-discuss (3)
- # kaocha (4)
- # lsp (128)
- # malli (12)
- # missionary (22)
- # off-topic (1)
- # pathom (7)
- # polylith (27)
- # quil (1)
- # re-frame (20)
- # react (9)
- # reitit (12)
- # releases (8)
- # remote-jobs (3)
- # sci (3)
- # shadow-cljs (9)
- # spacemacs (10)
- # tools-deps (7)
- # vim (7)
- # xtdb (14)
Very nice!
> There’s still more to do on the Babashka support, in particular this release doesn’t do anything at all with bb.edn. So if you’re adding extra dependencies via that those won’t work for the moment, and there’s no task running support yet either.
Note that print-deps
will also output the deps in bb.edn
Oh, interesting. Does that require bb
to be run in the directory containing bb.edn
? I assume so.
Currently a project-wide lib is created, but I actually think that’s not the right approach, especially given that information.
Ok. The only time anyone would see weirdness right now is if they have a large project with multiple bb.edn
files and different dependencies in each one.
What people can also do is using print-deps manually, create a deps.edn, develop as if normally on the JVM and then run the script with bb again when ready
clojure-lsp will also release a version today which leverages this new feature for better analysis
Is it possible for tasks to be discoverable from within project subdirectories?
I’m doing something similar. heres my script
#!/usr/bin/env bb
(require '[clojure.java.shell :refer [sh]]
'[clojure.string :as str]
'[babashka.fs :as fs]
'[babashka.process :as p :refer [process check]])
(defn find-up [target]
(let [here (:out (sh "pwd"))]
(loop [parents (iterate fs/parent here)]
(if-let [dir (first parents)]
(let [dir-str (str (str/trim (str dir)) "/bin")
local-files (set (str/split-lines (:out (sh "ls" dir-str))))]
(if (contains? local-files target)
dir-str
(recur (rest parents))))
(throw (ex-info "Not found." {:target-file target}))))))
(let [cmd (into ["bb"] (or *command-line-args* ["tasks"]))
p (process cmd {:dir (find-up "bb.edn")
:in :inherit})]
(when ((into {} System/getenv) "DEBUG")
(println "==================================================")
(println "cmd:" (pr-str cmd))
(println "dir:" (find-up "bb.edn"))
(println "=================================================="))
(binding [*in* (io/reader (:out p))]
(loop []
(when-let [x (read-line)]
(println x)
(recur)))))
@hmobrienv Currently bb only takes into account the bb.edn in the current working dir
Support for explicit bb.edn file would allow both to run the tasks from anywhere
and also to have different sets of tasks like admin-tasks.edn and dev-tasks.edn for different usages on the project.
bb --conf ~/prj1/bb.edn run test
@U1LG6HNMT The question here is: should --conf ...
take into account the relative sources the current working directory, or from the config directory
I think that the conf file might be the pivot. It will be relative to its location. I guess that explicit root would also be useful, maybe on the bb.edn to be able to override the default of conf file location. would that make sense?
@U1LG6HNMT I think there is a discussion about this exact topic here: https://github.com/babashka/babashka/discussions/869 Could you please leave your feedback there? Then we can collect all the data to make good decisions.
@hmobrienv You can invoke a command in a subdirectory from the top level bb.edn though, if that is your use case
I do a lot of work with Terraform so i’m rarely in project roots but have some complicated manual processes to build dependencies i’d like reachable anywhere. I suppose I can go the invoking commands in a subdirectory route. Thanks!
I'm considering forking tools.deps.alpha and ripping everything out but gitlibs and then see if that can be included in bb itself. That code should be relatively thin. And then the trade-off will be: use only (transitive) git libs and don't need Java for deps (only a git install), or use clojars/maven libs and then "pay" some Java startup time... I will then also attempt to port the git libs stuff to .cljc so it can be used on node (for #nbb)
I tried building babashka 0.5.1 (using the website tutorial) and the resulting jar takes 7 seconds to boot, did I miss something ?
Is there an option to suppress task output?
@agu.monkey The jar is not yet the binary
ok after letting my cpu overheat I finally get the snappiest ./bb thanks a ton (and massive congrats for assembling babashka, quite a gem)
Naming is hard, how do you call the folder where all the "shareable"/"model" code resides?
I am thinking of extrapolating things for babashka
scripts to use that are not related to database and all that. These are the actual domain pure functions...kind of like having .cljc
files for ClojureScript
yeah I was thinking about domain
- I just don't want to go for lib
or shared
cause they give small info to the reader
I put that into a file called b