This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-16
Channels
- # announcements (23)
- # babashka (15)
- # beginners (14)
- # calva (60)
- # circleci (1)
- # clerk (1)
- # clj-kondo (13)
- # cljdoc (7)
- # clojure (45)
- # clojure-austin (1)
- # clojure-bay-area (1)
- # clojure-brasil (4)
- # clojure-dev (9)
- # clojure-europe (24)
- # clojure-norway (105)
- # clojure-uk (2)
- # clojurescript (6)
- # conjure (1)
- # core-typed (4)
- # cursive (4)
- # datalevin (1)
- # datomic (25)
- # emacs (31)
- # fulcro (3)
- # humbleui (10)
- # hyperfiddle (19)
- # jobs (2)
- # luminus (3)
- # malli (13)
- # nbb (5)
- # off-topic (16)
- # polylith (2)
- # portal (7)
- # releases (2)
- # shadow-cljs (5)
- # sql (8)
Is it possible to use libpython with babashka? I want to be able to use the ruamel yaml parser?
no. babashka has clj-yaml built-in. you can shell out to python, but that's about it
@U4C3ZU6KX fyi In my experience I have found ruamel to be a lot buggier than pyyaml, which is odd as it is a fork of pyyaml.
You might want to try https://www.npmjs.com/package/yaml (JS) which also has comment support and is very solid.
This works with nbb but I don't see any comments:
(ns yaml.example
(:require ["yaml" :as yaml]))
(prn (yaml/parse "- foo # this is a comment" #js {:keepSourceTokens true :commentString prn}))
The comment option isn't listed under the parse options.
(https://eemeli.org/yaml/#options)Show 'n Tell: wait for a local dynamodb instance to come up for unit tests – all with babashka family tools
(ns mytest.core-test
(:require [babashka.fs :as fs]
[babashka.process :refer [process]]
[clojure.test :refer [deftest is]]
[babashka.wait :as wait]))
(def project-root (-> *file* fs/absolutize fs/normalize fs/parent fs/parent))
(def !ddb-local
(delay
(let [p (process {:inherit true, :shutdown babashka.process/destroy-tree}
(str project-root "/scripts/get-ddb-local") "run")]
(wait/wait-for-port "localhost" 8044))))
(deftest mytest
(deref !ddb-local)
...)
Note the babashka libs it uses • babashka.fs for easily find the folder • babashka.process for handling a subprocess (note the beautiful shutdown hook, which is exactly what I needed) • basbshka.wait to wait until the process is ready Thanks for the great libs @U04V15CAJ
(In fact, this test is written in Clojure, not bb, and just uses babashka.*
as deps)
It would be nicer still if clojure.test supported global fixtures (one for all tests), but delay+shutdown hook is good enough