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)
I believe I have asked this before but couldn't seem to find it from digging up the zulip logs. May I ask what ways are there to run python scripts from Clojure (backend)? I understand I can use clojure.java.shell/sh
or some java interop (?) (I recall someone might have mentioned there a new api to do so?), as well as graalvm
and lib-pythonclj
.
I want to send quite a lot of (database) data to the python scripts, would passing the python script a large json
work out alright? Would preferably like to keep it as a python script so that my friends working pick up Clojure and do interop
you could do something like, save the database data to a file (JSON maybe?) and then kick off a python script (from clojure or manually while testing) to read that JSON in and do whatever it needs to do
agree with cshep - use the file system as an async queue between applications.
Mmmm, I guess that does seem to be the best way :thinking_face: given the constraints. Just 2 questions -
How should I call python from clojure - is there a better way than clojure.java.shell/sh
?
Would the step of saving as a file be necessary - would sending the entire json in the call be better?
swap!
just calls compare-and-set! until it's accepted right?
well, and repeating calls to your provided function each time, too.
I know you said no lein/boot... is there another way to run a clojure program / clojure server process?
clojure is a java library, all you used to need is the java vm + a jar with clojure in it (plus your source), now you need a dep manager because clojure.jar no longer comes with all its deps
that's why deps.edn / the clj cli tool came out
similarly clojurescript is a java library (using clojure) that outputs js
you can still run clojure without a dep manager, if you get a valid classpath
(ins)justin@abjection:~$ CLJCP=$(clj -Spath)
(ins)justin@abjection:~$ echo $CLJCP
src:/home/justin/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar:/home/justin/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar:/home/justin/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
(ins)justin@abjection:~$ java -cp $CLJCP clojure.main
Clojure 1.10.1
user=> (+ 1 1)
2
of course I used the package manager to get those deps into the .m2 cache
@U3ES97LAC When @U01SUNLPN58 said “clojure clj” he meant the Clojure CLI — not Leiningen or Boot. And, yes, it is another way to “run a clojure program / clojure server process”. We use the Clojure CLI at work — with 112K lines of Clojure — we don’t use Leiningen, and we don’t use Boot. Although we did in the past (`lein` from 2011-2015, boot
from 2015-2018, CLI/`deps.edn` since 2018).
awesome