This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-27
Channels
- # announcements (8)
- # babashka (2)
- # calva (21)
- # clojure (30)
- # clojure-europe (4)
- # conjure (1)
- # core-logic (5)
- # data-science (1)
- # emacs (10)
- # hyperfiddle (1)
- # introduce-yourself (1)
- # luminus (62)
- # meander (23)
- # nbb (26)
- # off-topic (9)
- # reitit (2)
- # spacemacs (2)
- # squint (65)
- # tools-build (4)
- # tools-deps (17)
- # xtdb (20)
hi all. is it currently feasible to use clojure.spec.alpha
with nbb? I’ve done a couple things to try and make this work but keep coming up short.
I’m using the instructions here: https://github.com/babashka/nbb/blob/main/doc/dependencies.md to install dependencies from clojars
my nbb.edn:
{:deps {integrant/integrant {:mvn/version "0.8.0"}}}
script I am trying to run:
(ns script
(:require [deps]
[integrant.core :as ig]))
(println ig/ref)
result:
➜ nbb-classpath-issue-repro git:(master) ✗ npx nbb script.cljs
Downloading dependencies...
Extracting dependencies...
Done.
----- Error --------------------------------------
Message: Could not find namespace: clojure.spec.alpha
Could not find namespace: clojure.spec.alpha
I tried adding https://github.com/clojure/clojurescript as a dependency in my nbb.edn, and then changing
[clojure.spec.alpha :as s]
in nbb-deps/integrant/core.cljc
to be:
[cljs.spec.alpha :as s]
but i get the same error.
I’m sure there’s something pretty basic i’m missing here…@U03RD9KKKRS Currently clojure.spec doesn't work with nbb. However, malli does work
Gotcha. I guess I should've elaborated a little - the actual thing I was trying to accomplish is using Integrant with nbb. Is that a no-go since it makes use of clojure.spec? I assume I can just remove the spec parts from the integrant source code but I didn't know if there was an easier way
Ah right. Well, currently there's probably not an easier way. Babashka runs with a fork of clojure.spec.alpha (minor changes). Perhaps we can have a similar fork for nbb
I see. Yes, I read your post about the babashka/clojure.spec situation. Well okay, I'll have to play around with it a bit today and see what I can come up with
I'm not an expert at how to configure clj-kondo
for nbb
so I copied the .clj-kondo
folder from nbb into my repo folder. It still does not seem to grok the promesa
config. Is there a better way to configure it or do I have to clear caches or something?
if you include promesa in deps.edn and then run this:
$ clj-kondo --lint $(clojure -Spath) --dependencies --parallel --copy-configs
it should copy a config for promesa that worksThe steps that have been working for me:
1. Make sure clj-kondo is installed
2. Add the same version of promesa nbb uses to deps.edn
3. Open a file in an editor that makes use of clojure-lsp or clj-kondo
It should generate the .clj-kondo/* config files which includes the promesa types.
Would you be open to an nbb init
cmd kind of like package.json that populates some of those things like the deps.edn?
Could generate an nbb.edn file as well, saw some commits earlier for that feature. Thinking near equivalent to npm init
An alternative would maybe be a npm init template or a feature in #babashka-neil to add a clj-kondo config for a library
Anyway yeah I think a npm init nbb
package would definitely work if it was named create-nbb
% clj-kondo --lint $(clojure -Spath) --dependencies --parallel --copy-configs
No configs copied.
% cat deps.edn
; This file is only here to assist with editor integration, specifically Cursive on IntelliJ IDEA
; nbb DOES NOT USE THIS FILE - deps are built in (like promesa) or added via npm => package.json
{:paths ["src" "test"]
:deps {org.clojure/clojurescript {:mvn/version "1.11.51"}
funcool/promesa {:mvn/version "8.0.446"}
reagent/reagent {:mvn/version "1.1.0"}}}