This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-27
Channels
- # announcements (10)
- # aws (5)
- # babashka (91)
- # beginners (15)
- # biff (3)
- # calva (5)
- # clerk (24)
- # cljdoc (63)
- # clojure (69)
- # clojure-denver (1)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (50)
- # clojure-uk (2)
- # clojurescript (2)
- # community-development (6)
- # cursive (3)
- # datomic (4)
- # events (2)
- # fulcro (8)
- # gratitude (1)
- # hyperfiddle (19)
- # jobs-discuss (36)
- # nbb (21)
- # pathom (16)
- # portal (6)
- # re-frame (14)
- # reagent (1)
- # reitit (1)
- # releases (3)
- # remote-jobs (2)
- # shadow-cljs (56)
- # sql (15)
Seems like the output of fs/list-dir
can't be fed to shell
's dir
argument? And UnixPath
also doesn't seem to exist in the Java docs...
UnixPath
is a platform-specific implementation of java.nio.file.Path
: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Path.html
str
also does the trick and is a bit cleaner, thanks
Facing a problem with babashka v1.3.179
With a simple bb.edn
{:deps {io.github.babashka/sci.nrepl {:git/url ""
:git/sha "2f8a9ed2d39a1b09d2b4d34d95494b56468f4a23"}}
}
Running any bb command, bb tasks
for ex gets the following error
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" java.io.FileNotFoundException: /Users/nitinsharma/.clojure/.cpcache/81DABDD7A1785F8709441C9E4D357137.cp (No such file or directory)
at [email protected]/java.io.FileInputStream.open0(FileInputStream.java)
at [email protected]/java.io.FileInputStream.open(FileInputStream.java:219)
at [email protected]/java.io.FileInputStream.<init>(FileInputStream.java:158)
at $fn__11617.invokeStatic(io.clj:229)
at $fn__11617.invoke(io.clj:229)
at $fn__11569$G__11523__11576.invoke(io.clj:69)
at $fn__11591.invokeStatic(io.clj:165)
at $fn__11591.invoke(io.clj:165)
at $fn__11530$G__11519__11537.invoke(io.clj:69)
at $reader.invokeStatic(io.clj:102)
at $reader.doInvoke(io.clj:86)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:669)
at clojure.core$slurp.invokeStatic(core.clj:7009)
at clojure.core$slurp.doInvoke(core.clj:7009)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at borkdude.deps$_main.invokeStatic(deps.clj:816)
at borkdude.deps$_main.doInvoke(deps.clj:589)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at babashka.impl.deps$add_deps$fn__26947$fn__26948.invoke(deps.clj:101)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at babashka.impl.deps$add_deps$fn__26947.invoke(deps.clj:101)
at babashka.impl.deps$add_deps.invokeStatic(deps.clj:101)
at babashka.main$exec$fn__31702.invoke(main.clj:870)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at babashka.main$exec.invokeStatic(main.clj:822)
at babashka.main$main.invokeStatic(main.clj:1165)
at babashka.main$main.doInvoke(main.clj:1122)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at babashka.main$_main.invokeStatic(main.clj:1198)
at babashka.main$_main.doInvoke(main.clj:1190)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at babashka.main.main(Unknown Source)
This isn’t on my machine, it is remote so I might not be able to debug this immediately
They’ve tried removing .cpcache
The error still persists
Not sure what the issue is
Tagging @U05DY6M55C7
Can you please make a copy of /.deps.clj (archive it as a zip file, so I can repro the problem) and then remove that directory and try again? Please send /.deps.clj to me so I can reproduce the problem locally
-Sforce didn’t work.
@Nitin has shared the zip
We’ve deleted .cpcache
as well
yeah, done. That’s what .clojure
has at the moment
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Exception in thread "main" clojure.lang.ExceptionInfo: babashka.process.Process@63eca275
at babashka.process$check.invokeStatic(process.cljc:111)
at babashka.process$shell.invokeStatic(process.cljc:646)
at babashka.impl.deps$add_deps$fn__27048.invoke(deps.clj:100)
at borkdude.deps$_main.invokeStatic(deps.clj:969)
at borkdude.deps$_main.doInvoke(deps.clj:804)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at babashka.impl.deps$add_deps$fn__27055$fn__27056.invoke(deps.clj:106)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at babashka.impl.deps$add_deps$fn__27055.invoke(deps.clj:106)
at babashka.impl.deps$add_deps.invokeStatic(deps.clj:106)
at babashka.main$exec$fn__31821.invoke(main.clj:870)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at babashka.main$exec.invokeStatic(main.clj:822)
at babashka.main$main.invokeStatic(main.clj:1165)
at babashka.main$main.doInvoke(main.clj:1122)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at babashka.main$_main.invokeStatic(main.clj:1198)
at babashka.main$_main.doInvoke(main.clj:1190)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at babashka.main.main(Unknown Source)
I'm not sure. You can debug this by adding https://github.com/borkdude/deps.clj (e.g. as a local root so you can make changes to debug) to your deps.edn and then call:
clj -M -m borkdude.deps -Sdeps-file bb.edn
When you remove /.deps.clj and /clojure/.cpcache and use -Sforce, what do you see the very first time you run bb prepare
in the project?
Does there exist a Babashka-compatible library for copying to the clipboard? Something similar to pbcopy
or xclip
but cross-platform.
I'm trying to add some extra dependencies to a bb project like this:
bb \
-Sdeps '{:extra-deps {jmglov/bblib {:local/root "/home/jmglov/bblib"}}}} \
--config /home/jmglov/actions/bb.edn \
-m actions.main
When I try to require a namespace from bblib
, I'm getting a "Could not find namespace" exception. My bb.edn
looks like this:
{:paths ["src"]}
What am I doing wrong here?does it work if you pass --deps-root <path to bblib>
? along with --config
ahhh yes
Is there any way to add extra deps using -Sdeps
, or should I do something like build the classpath myself?
What I don't want to do is override the deps declared in bb.edn
, but rather add to them.
the map passed in -Sdeps will be merged last so more things will be picked up
same keys will prefer the one in -Sdeps
OK, so if I have {:deps {foo/bar {...}}
in my bb.edn
and pass -Sdeps '{:deps {baz/blah {...}}'
, I'll end up with a classpath containing both foo/bar
and baz/blah
?
its the same behavior as the jvm clojure cli
Yeah, so what I put in :deps
actually overrides the bb.edn
. That's what I was afraid of.
I'll probably just read in bb.edn
and merge the the deps myself, then. That seems like a fairly reasonable solution.
it doesn't override, it adds extra dependencies, like with the clojure CLI, by merging.
-Sdeps EDN
Deps data to use as the last deps file to be merged
hello. I have a question: is babashka compatible with guava? I was trying to use a https://github.com/deercreeklabs/lancaster and it breaks somewhere related to guava. I remember trying to use the plumatic schema library in the past, too, and having some problems with specific dependencies. does anyone know if it's there are workarounds to use these libraries?
@U04V15CAJ is there any workaround to working with it? someone told me about pods, but I haven't looked into it yet
pods could be a solution but I doubt it will be a good fit for this problem since pods themselves require serialization of objects
You could also look at #C029PTWD3HR which runs on Node.js and supports any Node.js library, but not sure what exactly you're looking for
As a workaround you can use bb to run a clojure programm that will call libs you needed throught the process, but in this case calling clojure directly may be a simpler choice.
Shower thought: In bb print-deps
, would it make sense to sort the dependencies? I find sorted dependencies easier to read.
Example of current behavior and proposed behavior:
CURRENT BEHAVIOR
{:deps
{selmer/selmer {:mvn/version "1.12.50"},
org.clojure/clojure {:mvn/version "1.11.1"},
org.clojure/tools.logging {:mvn/version "1.1.0"},
insn/insn {:mvn/version "0.5.2"},
org.clojure/tools.cli {:mvn/version "1.0.214"},
io.github.teodorlu/neil-quickadd {:local/root "."},
rewrite-clj/rewrite-clj {:mvn/version "1.1.46"},
babashka/babashka.core
{:git/url "",
:git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"},
org.flatland/ordered {:mvn/version "1.5.9"},
org.babashka/babashka.impl.java {:mvn/version "0.1.8"},
hiccup/hiccup {:mvn/version "2.0.0-alpha2"},
org.babashka/cli {:mvn/version "0.7.51"},
org.clojure/data.xml {:mvn/version "0.2.0-alpha8"},
org.clojure/data.csv {:mvn/version "1.0.0"},
com.taoensso/timbre {:mvn/version "6.0.1"},
com.cognitect/transit-clj {:mvn/version "1.0.333"},
babashka/babashka.curl {:mvn/version "0.1.2"},
clj-commons/clj-yaml {:mvn/version "1.0.26"},
org.clojure/core.rrb-vector {:mvn/version "0.1.2"},
org.babashka/sci.impl.types {:mvn/version "0.0.2"},
cheshire/cheshire {:mvn/version "5.11.0"},
babashka/process {:mvn/version "0.5.21"},
org.clojure/core.match {:mvn/version "1.0.0"},
org.babashka/http-client {:mvn/version "0.3.11"},
org.clojure/test.check {:mvn/version "1.1.1"},
babashka/fs {:mvn/version "0.4.19"},
org.clojure/data.priority-map {:mvn/version "1.1.0"},
nrepl/bencode {:mvn/version "1.1.0"},
org.clojure/core.async {:mvn/version "1.6.673"},
http-kit/http-kit {:mvn/version "2.7.0-RC1"}}}
PROPOSED BEHAVIOR
{:deps
{babashka/babashka.core
{:git/url "",
:git/sha "52a6037bd4b632bffffb04394fb4efd0cdab6b1e"},
babashka/babashka.curl {:mvn/version "0.1.2"},
babashka/fs {:mvn/version "0.4.19"},
babashka/process {:mvn/version "0.5.21"},
cheshire/cheshire {:mvn/version "5.11.0"},
clj-commons/clj-yaml {:mvn/version "1.0.26"},
com.cognitect/transit-clj {:mvn/version "1.0.333"},
com.taoensso/timbre {:mvn/version "6.0.1"},
hiccup/hiccup {:mvn/version "2.0.0-alpha2"},
http-kit/http-kit {:mvn/version "2.7.0-RC1"},
insn/insn {:mvn/version "0.5.2"},
io.github.teodorlu/neil-quickadd {:local/root "."},
nrepl/bencode {:mvn/version "1.1.0"},
org.babashka/babashka.impl.java {:mvn/version "0.1.8"},
org.babashka/cli {:mvn/version "0.7.51"},
org.babashka/http-client {:mvn/version "0.3.11"},
org.babashka/sci.impl.types {:mvn/version "0.0.2"},
org.clojure/clojure {:mvn/version "1.11.1"},
org.clojure/core.async {:mvn/version "1.6.673"},
org.clojure/core.match {:mvn/version "1.0.0"},
org.clojure/core.rrb-vector {:mvn/version "0.1.2"},
org.clojure/data.csv {:mvn/version "1.0.0"},
org.clojure/data.priority-map {:mvn/version "1.1.0"},
org.clojure/data.xml {:mvn/version "0.2.0-alpha8"},
org.clojure/test.check {:mvn/version "1.1.1"},
org.clojure/tools.cli {:mvn/version "1.0.214"},
org.clojure/tools.logging {:mvn/version "1.1.0"},
org.flatland/ordered {:mvn/version "1.5.9"},
rewrite-clj/rewrite-clj {:mvn/version "1.1.46"},
selmer/selmer {:mvn/version "1.12.50"}}}
Might be possible to add an (into (sorted-map) ,,,
here:
https://github.com/babashka/babashka/blob/85eef7d6f705d562a2e2c96363f679ae9827410c/src/babashka/impl/print_deps.clj#L35-L36
PR: https://github.com/babashka/babashka/pull/1582 I haven't written any tests. Should this be tested? This is the whole code change:
$ git show 9aa706ee
commit 9aa706ee1971ee75e1dd1e180ea53e4079fd189e
Author: Teodor Heggelund <[email protected]>
Date: Tue Jun 27 16:08:58 2023 +0200
`bb print-deps`: sort dependencies
diff --git a/src/babashka/impl/print_deps.clj b/src/babashka/impl/print_deps.clj
index ca0d5c40..593fd836 100644
--- a/src/babashka/impl/print_deps.clj
+++ b/src/babashka/impl/print_deps.clj
@@ -30,6 +30,7 @@
'org.hsqldb/hsqldb)
bb-edn-deps (:deps @common/bb-edn)
deps (merge deps bb-edn-deps)
+ deps (into (sorted-map) deps)
paths (:paths @common/bb-edn)
deps {:deps deps}
deps (cond-> deps
> I haven't written any tests. Should this be tested? Only if you want to capture this behavior so that it won't accidentally be reverted in a future release.
@U3X7174KS It's not clear to me if 👍 means: yeah fuck it, I'll just take the risk, or yes, I'll follow up with a test
Thanks. I'll follow up with tests. But I need to install stuff first (like GraalVM), I've never run Babashka from source before.
@U3X7174KS you can just execute lein test :only babashka.print-deps-test
or whatever. If it works in the JVM, I think this test will also work with graalvm
I wrote this test (https://github.com/teodorlu/babashka/blob/88a7d12dac74e3ecd5860543651cfe2ee18668a7/test/babashka/print_deps_test.clj#L26-L28), but it doesn't work:
(testing "keys in dep map are sorted"
(let [deps-data (edn/read-string deps)]
(is (sorted? (keys (:deps deps-data))))))
clojure.edn/read-string
reads into a hash map. And when I ask for keys
, I get a different order than the string.
Does it make sense to use rewrite-clj for this instead of clojure.edn?You could do that. You can use rewrite-edn to get the deps entry and then check if the keys are alphabetically sorted
Do you prefer rewrite-edn or rewrite-clj?
I noticed that rewrite-clj
is a toplevel dependency, whereas rewrite-edn
only is in the :babashka/dev
alias.