This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-28
Channels
- # aleph (3)
- # babashka (66)
- # beginners (96)
- # calva (45)
- # clj-kondo (28)
- # clojure (30)
- # clojure-dev (2)
- # clojure-europe (20)
- # clojure-germany (22)
- # clojure-norway (4)
- # clojurescript (176)
- # clojutre (1)
- # cursive (23)
- # datalog (6)
- # datomic (7)
- # docker (3)
- # emacs (3)
- # exercism (4)
- # figwheel-main (5)
- # fulcro (8)
- # gratitude (9)
- # hyperfiddle (8)
- # introduce-yourself (2)
- # jobs (2)
- # malli (4)
- # membrane (3)
- # off-topic (17)
- # polylith (3)
- # portal (2)
- # re-frame (27)
- # reitit (3)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (152)
- # spacemacs (8)
- # tools-deps (15)
- # vscode (1)
- # xtdb (24)
Trying something on our work linux servers with babashka. How do I add a dependency to say babashka.fs in my remote machine which is restricted from using the internet? I tried copying babashka.fs files from github to the remote under ~/bb-deps/fs-master path and used deps.edn to add dependency as : {:deps {local/deps {:local/root "~/bb-deps/fs-master/"}}} I tried fs-master as well as fs-master/src in the deps.edn above, and it doesn't work. My definition of "doesn't work" is that I get the following error for adding a simple :require for babashka.fs in a helloworld.clj file -- Don't know how to create ISeq from: clojure.lang.Keyword
@mukundzare babashka.fs is built into babashka, you don't need a dependency on that
I thought so too, but it was throwing the error message regardless of the dependency so I tried adding a dependency.
Not the smartest thing.. But was a wild guess
> but it was throwing the error message Maybe you could start there, what error message
Sorry for the potato quality photo.. I can't access slack from work, have to chat via mobile
This is the code
hello, we are starting to use babashka on deploy scripts in my company, but I notice that every time I run it, I'm getting:
Could not find /root/.deps.clj/1.11.0.1100/ClojureTools/clojure-tools-1.11.0.1100.jar
Downloading tools jar from to /root/.deps.clj/1.11.0.1100/ClojureTools
Downloading: babashka/babashka.nrepl/0.0.6/babashka.nrepl-0.0.6.pom from clojars
I tried to cache those deps, but in Gitlab we cannot cache deps that are not in the same project, so, is there a way to change this directory .deps.clj
? I tried using export DEPS_CLJ_TOOLS_DIR
, but since the dir is empty it keeps downloading to /root/.deps.clj
anyway. in the end what I want to have the script run without spending so much time downloading these deps@wilkerlucio This seems to work?
borkdude@MBP2019 /tmp/yolo $ DEPS_CLJ_TOOLS_DIR=. bb clojure -M -e '(+ 1 2 3)'
Could not find ./clojure-tools-1.11.0.1100.jar
Downloading tools jar from to .
6
borkdude@MBP2019 /tmp/yolo $ DEPS_CLJ_TOOLS_DIR=. bb clojure -M -e '(+ 1 2 3)'
6
one curiosity, why babashka deps uses a different cache directory? why don't use ~/.m2/repositories
with the rest of maven deps?
@wilkerlucio that's not what the clojure CLI uses either, it uses /usr/local/lib
etc to store those libs
ah, ok, I'm seeing I don't really understand those deps, I though they were all jars from mvn deps
I have tried to point the deps dir to where clojure is installed, that didn't worked, but now I'm trying to use a custom, local directory and cache it, but currently it takes 15 min to run that task, hopefully the cache will work with the local path setup
this is what my gitlab task looks like now:
build-artifact:
stage: artifact
script:
- export GITLIBS=".gitlibs/"
- export DEPS_CLJ_TOOLS_DIR=".deps-clj"
- which clojure
- bb DO_THING
cache:
key:
files:
- deps.edn
paths:
- ./.m2/repository
- ./.gitlibs
- ./.deps-clj
I find the gitlab limitation to only cache directories that are local to the repo to be quite annoying, because requires all these path alterations to have any cache at all
yeah, I have to, given the Gitlab constraints
there is an issue with 6+ years on gitlab about this https://gitlab.com/gitlab-org/gitlab/-/issues/14151
not sure, there are a lot of deps here in this process that I'm not familiar with yet
currently it takes about 10min just downloading deps
the beginning of the list:
Could not find .deps-clj/clojure-tools-1.11.0.1100.jar
Downloading tools jar from to .deps-clj
Downloading: babashka/babashka.nrepl/0.0.6/babashka.nrepl-0.0.6.pom from clojars
Downloading: nrepl/bencode/1.1.0/bencode-1.1.0.pom from clojars
Downloading: org/babashka/sci/0.3.2/sci-0.3.2.pom from clojars
Downloading: borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.pom from clojars
Downloading: borkdude/edamame/0.0.19/edamame-0.0.19.pom from clojars
Downloading: org/clojure/tools.reader/1.3.4/tools.reader-1.3.4.pom from central
Downloading: org/clojure/pom.contrib/0.2.2/pom.contrib-0.2.2.pom from central
Downloading: borkdude/edamame/0.0.19/edamame-0.0.19.jar from clojars
Downloading: org/clojure/tools.reader/1.3.4/tools.reader-1.3.4.jar from central
Downloading: org/babashka/sci/0.3.2/sci-0.3.2.jar from clojars
Downloading: borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar from clojars
Downloading: nrepl/bencode/1.1.0/bencode-1.1.0.jar from clojars
Downloading: babashka/babashka.nrepl/0.0.6/babashka.nrepl-0.0.6.jar from clojars
Downloading pod org.babashka/aws (0.1.2)
Successfully installed pod org.babashka/aws (0.1.2)
Cloning:
Checking out: at 7d40500863818c6f9a6e077b18db305d02149384
Downloading: org/clojure/clojure/1.11.0/clojure-1.11.0.pom from central
What I mean is, if you're using babashka, you don't really need these deps, they are built into babashka
babashka is installed there, when/why it needs to download those tools?
I've never seen it before as well, I'm used to make these setups on Github, but using the marketplace there things just work fine, now on Gitlab I'm facing these things because I'm bad at setting up those 😛
> babashka is installed there, when/why it needs to download those tools? like I said, for babashka itself this isn't necessary. perhaps you or one of your colleagues put those into deps.edn or bb.edn. I don't know :)
we do use tools build, the babashka command getting ran here is:
(shell "clojure" "-Sdeps" "{:mvn/local-repo \"./.m2/repository\"}" "-A:prod" "-T:build" "uber" "env" "prod")
seems like I got the Could not find .deps-clj/clojure-tools-1.11.0.1100.jar
fixed! thanks!
but it still downloading more deps, I guess because of the aws
pod usage
Downloading: babashka/babashka.nrepl/0.0.6/babashka.nrepl-0.0.6.pom from clojars
Downloading: nrepl/bencode/1.1.0/bencode-1.1.0.pom from clojars
Downloading: org/babashka/sci/0.3.2/sci-0.3.2.pom from clojars
Downloading: borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.pom from clojars
Downloading: borkdude/edamame/0.0.19/edamame-0.0.19.pom from clojars
Downloading: org/clojure/tools.reader/1.3.4/tools.reader-1.3.4.pom from central
Downloading: org/clojure/pom.contrib/0.2.2/pom.contrib-0.2.2.pom from central
Downloading: borkdude/edamame/0.0.19/edamame-0.0.19.jar from clojars
Downloading: org/clojure/tools.reader/1.3.4/tools.reader-1.3.4.jar from central
Downloading: org/babashka/sci/0.3.2/sci-0.3.2.jar from clojars
Downloading: borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar from clojars
Downloading: nrepl/bencode/1.1.0/bencode-1.1.0.jar from clojars
Downloading: babashka/babashka.nrepl/0.0.6/babashka.nrepl-0.0.6.jar from clojars
Downloading pod org.babashka/aws (0.1.2)
Successfully installed pod org.babashka/aws (0.1.2)
(pods/load-pod 'org.babashka/aws "0.1.2")
(require '[pod.babashka.aws :as aws])
when we go though this way, where the deps get saved?
This is currently not configurable but you could download the pod yourself and load it from a specified path
cool, I'm going to dig down on what is making those deps load, because I currently don't understand it
when running bb
, I believe my current thing to change the mvn/local-repo
isn't applying for bb, I tried using -Sdeps
but I see bb doesn't support it, is there a way to tell bb
to use a custom directory for mvn deps?
humm, but I need to make it different when running local vs CI, otherwise its gonna be a mess for development
yes, I understand, but we don't have a good solution for this right now. you could make a copy of the bb.edn and name it bb-ci.edn and then run with bb --config bb-ci.edn
cool, gonna try this path
deps in deps.edn
are never requested by bb unless you use a local/root on the current project or so
I forgot to mention, the locations were pod stuff is downloaded can be influenced by setting XDG_CACHE
and XDG_DATA
I will add BABASHKA_PODS_DIR
for the next release which will cover everything related to pod downloading
hi - I'm trying to make use of this java lib via bb: https://github.com/tomas-langer/chalk I've included it in bb.edn like so:
$ cat bb.edn
{:min-bb-version
"0.4.0"
:paths
["src"]
:deps
{com.github.tomas-langer/chalk
{:mvn/version "1.0.2"}}}
I see it is on the classpath:
$ bb print-deps --format classpath | tr : \\n | sort
/Users/alpha/.gitlibs/libs/babashka/babashka.core/52a6037bd4b632bffffb04394fb4efd0cdab6b1e/src
/Users/alpha/.m2/repository/babashka/babashka.curl/0.1.1/babashka.curl-0.1.1.jar
/Users/alpha/.m2/repository/babashka/fs/0.1.2/fs-0.1.2.jar
/Users/alpha/.m2/repository/cheshire/cheshire/5.10.2/cheshire-5.10.2.jar
/Users/alpha/.m2/repository/clj-commons/clj-yaml/0.7.108/clj-yaml-0.7.108.jar
/Users/alpha/.m2/repository/com/cognitect/transit-clj/1.0.329/transit-clj-1.0.329.jar
/Users/alpha/.m2/repository/com/cognitect/transit-java/1.0.362/transit-java-1.0.362.jar
/Users/alpha/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.12.4/jackson-core-2.12.4.jar
/Users/alpha/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-cbor/2.12.4/jackson-dataformat-cbor-2.12.4.jar
/Users/alpha/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-smile/2.12.4/jackson-dataformat-smile-2.12.4.jar
/Users/alpha/.m2/repository/com/github/tomas-langer/chalk/1.0.2/chalk-1.0.2.jar
but I am unable to import it:
$ rlwrap bb
Babashka v0.8.1 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (import com.github.tomaslanger.chalk.Chalk)
java.lang.Exception: Unable to resolve classname: com.github.tomaslanger.chalk.Chalk [at <repl>:3:1]
I also confirmed it is on local disk:
(base) Thu Apr 28, 15:51:23:~/.m2/repository/com/github/tomas-langer/chalk/1.0.2
$ jar tf chalk-1.0.2.jar
META-INF/
META-INF/MANIFEST.MF
com/
com/github/
com/github/tomaslanger/
com/github/tomaslanger/chalk/
org/
org/fusesource/
org/fusesource/jansi/
com/github/tomaslanger/chalk/Ansi$AnsiCode.class
com/github/tomaslanger/chalk/Ansi$BgColor.class
com/github/tomaslanger/chalk/Ansi$Color.class
com/github/tomaslanger/chalk/Ansi$Modifier.class
com/github/tomaslanger/chalk/Ansi.class
com/github/tomaslanger/chalk/Chalk$1.class
com/github/tomaslanger/chalk/Chalk$NoOpChalk.class
com/github/tomaslanger/chalk/Chalk.class
Not sure what else to try. I'm not sure if this lib is graalvm compatible, but figured I'd get some errors if that was the casethe underlying lib makes use of some JNI libs: https://github.com/fusesource/jansi so maybe that's the problem? is there a way to determine if a lib is supported or not in bb?
I'm (perhaps obviously) attempting to add colorized/styled text output to a terminal - if there is a way to do that in bb some other way, I'd be open to use that too
answering my own q: https://github.com/babashka/babashka/blob/master/doc/projects.md#clojure-term-colors i am curious though about why that above import failed..
Because babashka cannot use any other Java classes than those that are built-in.
com.github.tomaslanger.chalk.Chalk