This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-31
Channels
- # announcements (3)
- # babashka (75)
- # beginners (16)
- # calva (124)
- # cider (10)
- # clara (2)
- # clj-kondo (1)
- # cljdoc (4)
- # cljs-dev (14)
- # clojure (104)
- # clojure-australia (4)
- # clojure-czech (5)
- # clojure-europe (14)
- # clojure-germany (48)
- # clojure-nl (4)
- # clojure-serbia (4)
- # clojure-uk (34)
- # clojurescript (60)
- # community-development (16)
- # conjure (12)
- # core-async (34)
- # cursive (42)
- # data-science (7)
- # deps-new (9)
- # depstar (1)
- # emacs (11)
- # events (2)
- # fulcro (15)
- # graalvm (1)
- # inf-clojure (1)
- # jobs (3)
- # jobs-discuss (1)
- # joker (7)
- # juxt (8)
- # lsp (20)
- # malli (42)
- # meander (4)
- # off-topic (5)
- # pathom (2)
- # polylith (13)
- # re-frame (39)
- # reagent (9)
- # reitit (31)
- # releases (2)
- # rewrite-clj (23)
- # shadow-cljs (39)
- # spacemacs (11)
- # specter (6)
- # tools-deps (8)
- # xtdb (12)
A small demo how you might leverage fully qualified main functions: https://twitter.com/borkdude/status/1377185155077402627
Any Windows users want to help with this issue? https://github.com/babashka/babashka/issues/766
I see you use bat
I am trying to get them to respect emacs modelines since they don’t respect bb
on the shebang as clojure
or linux? you can use this trick: https://gist.github.com/borkdude/e6f0b12f9352f3375e5f3277d2aba6c9#file-assoc_pairs-clj-L2
no no
yeah, but bat
would use bash
syntax
Yeah, funny confusion 🙂
Just upgraded rewrite-clj’s scripts to use bb v0.3.1's bb.edn
, https://github.com/clj-commons/rewrite-clj/commit/7bac58d5bde68b22761d71eaf0592322d1996ace!
@UE21H2HHD Just FYI, this pattern exists:
https://book.babashka.org/#main_file
Maybe it comes in handy somewhere in rewrite-clj if you want to prevent side effects when e.g. execute bb doc ...
Cool, thanks, I was going to switch to that convention when/if I switched to vanilla tasks, but I think it is probably worth doing now.
If I create a uberjar
or a uberscript
, would my pods be included there as well?
I see, given target machine is compatible with dev machine, how would you recommend distributing a .bb
script that uses, for instance, the sql pod?
@U0C8489U6 if you use (load-pod 'org.babashka/postgresql "0.0.x")
the pod will be automatically downloaded
yeah I am in an environment where I am not likely to access the internet
@U0C8489U6 In this case it's better to download the pod(s) yourself and copy them yourself to your artifact/docker image/container
would just cloning the repo do the job there? (sorry newbie question)
oh never mind, i found this https://github.com/eccentric-j/idle-parens/blob/8f4142d66698adadb321ace92da9ed79bbcbcedc/resources/blog/2021-01-27-clojure-like-its-php.md#download--install-babashka-postgresql-pod
I have an additional question on this one...I have ":/home/cokap/.m2/repository/org/postgresql/postgresql/42.2.2/postgresql-42.2.2.jar"
as result of babashka.classpath/get-classpath
...why can't I (import 'org.postgresql.util.PGobject)
? Am I missing something?
no unfortunately I have to store a BYTEA
oh cool! I was worried for a second 😄 let me try that
works flawlessly!
[query "INSERT INTO file_blobs (name, mime_type, byte_size, content) VALUES (?, ?, ?, ?) RETURNING id"
sqlvec [query (:title image) (:mime-type image) (:byte-size image) (Files/readAllBytes (:jpath image))]
inserted-rows (db/execute! db sqlvec)]
Here’s a ramble-thought. My bb scripts used to fail fast if a they were not being run with a minimum version of bb. This was done as nicety for folks running my bb scripts. Instead of a mysterious failure, they’d get “hey, upgrade your bb, buddy”. I just removed this min version check because it, ironically, it was relying on recent bb features. My question is: Would it make sense for a bb script or maybe bb.edn to somehow specify a min version of bb and fail fast if that version is not met? I realize this would only help bb versions moving forward, so maybe my idea is a bit late.
Oh, that's a great suggestion! I was considering adding something code-wise in bb for it: https://github.com/babashka/babashka/issues/663
but adding this to bb.edn
is probably even better
node.js has a similar feature for ensuring the version of the runtime (and even the OS and the CPU arch): https://docs.npmjs.com/cli/v7/configuring-npm/package-json#engines it's not necessarily the best place to copy ideas from, but might give u some ideas.
I also quite like the version-clj library, but this isn't built-in and have people require it just to compare the bb version is a bit too much overhead maybe
I am surprised more languages don’t offer this kind of check. Or maybe they do, and I am just not aware. I mean backward compatibility is great but it would be nice to effectively say, “yeah, we don’t support forward compatibility, you’ll need to upgrade” instead of failing mysteriously when an old version of tool x tries to access a non-existent new feature.
I guess in deps.edn you can just say {:deps {org.clojure/clojure {:mvn/version "1.11.0"}}}
and that's your minimum version
Can’t remember about pom.xml
I think there is something in there about what version you want to compile to.
FWIW I meant this option: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L37
This is maybe a bad idea, but we could (not should) make :min-bb-version
download the min bb version and run the project using that one, so the system bb invokes the needed bb if it's below the minimum
Gradle just wafted into my brain. I think I remember it downloading whatever version the gradle file specifies.
Ya, I remember it being convenient - so long as you didn’t want to do anything it does not normally do, then, oh boy!
then use make/bash + XML-generate the pom.xmls? Sounds a bit like what I'm doing now with deps.edn sometimes ;)
From a security perspective you don't want tools to randomly download binaries, just saying
@lukaszkorecki Yeah, I understand from that point of view. I started wondering though: what's the difference with downloading binaries (from a controlled source) or .jar files for that matter? Both can screw up your system, but somehow binaries are often considered more suspicious
Jars are not usually executable, in this case a binary downloads another binary and replaces itself, right?
In some setups machines come with pre-installed stuff, and this approach might not even be an option
Note that pod binaries can now be downloaded automatically from a pod registry when loading them, this was by popular request. The bb binary would not replace the system bb, the system bb would just delegate to the newer one if needed.
Yeah, I'm not implementing this in the foreseeable future, just throwing it out here for initial feedback.
yeah @lukaszkorecki I sometimes do work on cljdoc and it has a (probably not well known?) feature where you can download a zipped version of docs for offline viewing. I was thinking this could be a potential vehicle, however unlikely, to get something nasty on somebody’s system, if we aren’t careful.
fyi: the pom.xml can support dependency ranges, https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402