This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-18
Channels
- # announcements (18)
- # babashka (34)
- # beginners (47)
- # biff (1)
- # calva (99)
- # cider (1)
- # clojure (99)
- # clojure-austin (13)
- # clojure-australia (1)
- # clojure-dev (53)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-spec (7)
- # clojure-uk (1)
- # clojurescript (50)
- # cursive (11)
- # datahike (20)
- # datomic (10)
- # fulcro (7)
- # graalvm (8)
- # gratitude (1)
- # introduce-yourself (7)
- # jackdaw (1)
- # joyride (1)
- # lambdaisland (7)
- # lsp (2)
- # malli (7)
- # nbb (1)
- # off-topic (1)
- # portal (24)
- # re-frame (8)
- # reagent (13)
- # reitit (7)
- # releases (2)
- # remote-jobs (8)
- # rewrite-clj (3)
- # sci (1)
- # scittle (21)
- # shadow-cljs (2)
- # testing (3)
- # tools-deps (22)
- # web-security (19)
Is babashka in apt repositories (for Ubuntu)? I’m helping someone install Babashka. (or perhaps suggest the best route for them… maybe the curl?)
According to https://github.com/babashka/babashka#installation it seems (Linux) Brew or curl
are the recommended choices.
I use brew
for Ubuntu but only for Clojure tool installs -- brew
is too opinionated for other stuff, IMO.
I didn’t know Brew is on non-mac platforms… thanks!
They ended up curling it but they’ll have to remember to update it.
Hi guys, Is it possible in babashka to use external for clojure libraries? I have a simple file that want to convert to script which I want to execute from the terminal. I have two dependencies -> net.cgrand.enlive-html and morse.api
quick reply from me - borkdude can give the "correct response" later if he wants to: 1 - you can use any babashka-dependencies directly. Here's an example from my stuff:
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {org.babashka/cli {:mvn/version "0.3.31"}
eu.teod/pandoc-toolbox {:local/root "../pandoc-toolbox"}}})
(require '[babashka.cli :as cli]
'[babashka.fs :as fs]
'[clojure.java.shell]
'[clojure.string :as str]
'[clojure.edn :as edn]
'[clojure.pprint :refer [pprint]]
'[cheshire.core :as json]
'[teod.pandoc-toolbox :as pandoc])
(https://github.com/teodorlu/play.teod.eu/blob/0792c7a05503dc201f6c488ce19a01ab7e92ce6d/play.clj#L23-L33)
2 - for babasha-incompatible dependencies, there are pods
A pod is a protocol to talk from a babashka-script to a library written in some other way.
Pod docs: https://book.babashka.org/#podsthank you, I'll try the first approach you mentioned
enlive doesn't work in bb due to the Jsoup dependency but there are pods that do work with bb for parsing HTML: the bootleg pod for example
If Node.js is an option for you, there's also #nbb which gives access to NPM libraries. Here is an example of that: https://github.com/babashka/nbb/blob/main/examples/posthtml-parser/example.cljs
1.0 announcement: https://clojurians.slack.com/archives/C06MAR553/p1666110395981829
Question, can bb
work if I include a bb.edn
from another bb.edn
(as local/root
)?
I get
Error building classpath. Manifest type not detected when finding deps for acuity/scripting in coordinate #:local{:root "/home/cokap/git/cohesic/acuity/scripting"}
But maybe I am missing somethingwe dont support local/root in bb.edn not a part of its spec.
as in look for a bb.edn when specified in a local/root
you could maybe do :paths ["other repo path"]
and then you can require namespaces from that?
:local/root
is supported in bb.edn
but the local/root you are referring to has to have deps.edn
bb.edn
dependencies are only considered for the local working directory, not for resolving other dependencies, that always goes via deps.edn
Thank you both that is clear now
I made it work, the only oddity is that the :pods
declaration need to stay in the parent if I want to be able to exec :tasks
@U0C8489U6 There is ongoing work to support pod manifests in libraries so in the future I hope that will be easier (cc @U06FS3DLH)
I am having some problems with dependency resolution, and I don’t want to make my users have to use -Sforce
to overcome it. I hope there’s a better way. I am trying to use a dependency from maven, here’s a minimal example:
{:deps {clojure-term-colors/clojure-term-colors {:mvn/version "0.1.0"}}
:tasks {red {:requires ([clojure.term.colors :as c])
:task (println (c/red "hi"))}}}
If I run: rm -rf ~/.m2 && bb red
, I get the following error:
----- Error --------------------------------------------------------------------
Type: java.nio.file.NoSuchFileException
Message: /Users/me/.m2/repository/clojure-term-colors/clojure-term-colors/0.1.0/clojure-term-colors-0.1.0.jar
Location: <expr>:4:47
Running rm -rf ~/.m2 && bb -Sforce red
works. It seems like whenever the library is missing it should get downloaded, but that is not the case. What am I missing?This is expected. The clojure CLI and also babashka (via deps.clj) cache their classpath for performance/startup time reasons. These caches aren't aware of anything you delete manually from .m2
Alright, thanks for explaining that. My colleague is seeing something different, when he moves his ~/.m2 dir and runs bb -Sforce red
, he gets:
...
Downloading: org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar from central
Downloading: ...
Downloading: clojure-term-colors/clojure-term-colors/0.1.0/clojure-term-colors-0.1.0.jar from clojars
Error while executing task:
Which I just can’t fathom, but it must be coming from here: https://github.com/babashka/babashka/blob/4aa352c94ac9885a1ee896679104dd2461220e2d/src/babashka/impl/tasks.clj#L53Would this indicate an error happening before the task is loaded? I’ll keep digging
You could maybe just put that code in a standalone script , to exclude anything task related
There's a better solution now in deps.clj which will end up in the next bb: https://clojurians.slack.com/archives/CLX41ASCS/p1666260322376039?thread_ts=1666257220.078089&cid=CLX41ASCS