Fork me on GitHub
#nextjournal
<
2022-01-27
>
Carlo16:01:49

Wow this is awesome! I'll try it out later today 😍

Stuart18:01:34

I'm following the Using Clerk section on the github. I've added it to my deps.edn and it downloaded a bunch of stuff. I saw no errors.

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        io.github.nextjournal/clerk {:mvn/version "0.5.346"}}}
Then I try to add it to the require
(ns stuartstein777.scratch
  (:require [clojure.set :as set]
            [clojure.string :as str]
            [stuartstein777.handy-functions :as helpers]
            [nextjournal.clerk :as clerk]))
Eval the ns and I get the error:
Syntax error compiling at (nextjournal/clerk/hashing.clj:2:1). namespace 'nextjournal.markdown' not found

Stuart18:01:49

Am I doing something stupid ?

mkvlr19:01:45

I hope I didn't do something stupid and release a broken thing 😓 will try this in a bit

mkvlr19:01:31

though https://github.com/nextjournal/clerk-demo was also green on CI. Can you try if that works for you?

Stuart19:01:31

I can't jack into a repl on that. I get a different error

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}'  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error building classpath. Library jackrusher/mundaneum has missing :sha in coordinate.
Jack-in process exited. Status: 1

Stuart19:01:09

If I select to Jack in using the clerk alias I get the error

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}' -A:nextjournal/clerk -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
Error building classpath. Unknown alias key: :exec-fn
Jack-in process exited. Status: 1

Stuart19:01:27

must be something wrong on my end

Stuart19:01:34

That sha for the jackrusher/mundaneum is correct.

Stuart19:01:10

ok, took the mundaneum stuff out and the projecf works now, repl jacks in and I can eval the ns on user.clj with no error.

mkvlr19:01:25

can you try upgrading your clojure cli? Older versions do not understand the namespaced sha

Stuart19:01:42

but all the clerk stuff works on this project, I can eval (clerk/show!) and see it in the browser 🙂

😅 1
Stuart19:01:57

I'll look to upgrade my clojure

🙏 1
mkvlr19:01:37

still curious to learn what could cause the error on the sample project

Stuart19:01:59

Yeah, my deps.edn is literally just

{:paths ["src" "resources"]
 :deps {io.github.nextjournal/clerk {:mvn/version "0.5.346"}
        }}

Stuart19:01:02

Is that sufficient ?

mkvlr19:01:07

@U013YN3T4DA nope, that works here…

mkvlr19:01:16

clj -X:deps tree | head
org.clojure/clojure 1.10.3
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56
io.github.nextjournal/clerk 0.5.346
  . weavejester/dependency 0.2.1
  . org.clojure/tools.analyzer.jvm 1.1.0
    . org.clojure/tools.analyzer 1.0.0
    . org.clojure/core.memoize 1.0.236
      . org.clojure/core.cache 1.0.207
        . org.clojure/data.priority-map 1.0.0

mkvlr19:01:24

what does this bring in for you?

Stuart19:01:53

(base) [19:43]: [email protected]:~$ clj -X:deps tree | head
Unqualified function can't be resolved: tree

Stuart19:01:58

I'm on Ubuntu if that matters

mkvlr19:01:18

clj -Stree I think it is for older cli versions

Stuart19:01:50

(base) [19:49]: [email protected]:~/Source/clojure/cljcodewars$ clj -Stree
DEPRECATED: Libs must be qualified, change deps-deploy => deps-deploy/deps-deploy (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change expectations => expectations/expectations (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change criterium => criterium/criterium (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change proto-repl => proto-repl/proto-repl (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change nrepl => nrepl/nrepl (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change deps-deploy => deps-deploy/deps-deploy (/home/stuart/.clojure/deps.edn)
DEPRECATED: Libs must be qualified, change compliment => compliment/compliment (/home/stuart/.clojure/deps.edn)
org.clojure/clojure 1.10.3
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56
io.github.nextjournal/clerk 0.5.346
  . weavejester/dependency 0.2.1
  . org.clojure/tools.analyzer.jvm 1.1.0
    . org.clojure/tools.analyzer 1.0.0
    . org.clojure/core.memoize 1.0.236
      . org.clojure/core.cache 1.0.207
        . org.clojure/data.priority-map 1.0.0
    . org.ow2.asm/asm 5.2
    X org.clojure/tools.reader 1.3.2 :superseded
  . rewrite-clj/rewrite-clj 1.0.699-alpha
    . org.clojure/tools.reader 1.3.6 :newer-version
  . io.github.nextjournal/markdown 0.2.44
    X org.clojure/data.json 0.2.6 :superseded
    . org.graalvm.js/js 21.3.0
      . org.graalvm.regex/regex 21.3.0
        . org.graalvm.truffle/truffle-api 21.3.0
      . org.graalvm.truffle/truffle-api 21.3.0
        . org.graalvm.sdk/graal-sdk 21.3.0
      . org.graalvm.sdk/graal-sdk 21.3.0
      . com.ibm.icu/icu4j 69.1
    . applied-science/js-interop 0.2.6
      . appliedscience/js-interop 0.2.6-MOVED
    . org.graalvm.js/js-scriptengine 21.3.0
      . org.graalvm.sdk/graal-sdk 21.3.0
    X lambdaisland/uri 1.10.79 :older-version
  . com.nextjournal/beholder 1.0.0
    . io.methvin/directory-watcher 0.15.0
      . net.java.dev.jna/jna 5.7.0
      . org.slf4j/slf4j-api 1.7.30
  . hiccup/hiccup 2.0.0-alpha2
  . org.clojure/java.classpath 1.0.0
  . org.clojure/tools.deps.alpha 0.11.905
    . org.apache.maven.resolver/maven-resolver-api 1.6.1
    . org.apache.maven.resolver/maven-resolver-spi 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
    . org.apache.maven.resolver/maven-resolver-impl 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
      . org.apache.maven.resolver/maven-resolver-spi 1.6.1
      . org.apache.maven.resolver/maven-resolver-util 1.6.1
      . org.apache.commons/commons-lang3 3.8.1
      . org.slf4j/slf4j-api 1.7.30
    . org.apache.maven.resolver/maven-resolver-util 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
    . org.apache.maven.resolver/maven-resolver-connector-basic 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
      . org.apache.maven.resolver/maven-resolver-spi 1.6.1
      . org.apache.maven.resolver/maven-resolver-util 1.6.1
      . org.slf4j/slf4j-api 1.7.30
    . org.apache.maven.resolver/maven-resolver-transport-file 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
      . org.apache.maven.resolver/maven-resolver-spi 1.6.1
      . org.slf4j/slf4j-api 1.7.30
    . org.apache.maven.resolver/maven-resolver-transport-http 1.6.1
      . org.apache.maven.resolver/maven-resolver-api 1.6.1
      . org.apache.maven.resolver/maven-resolver-spi 1.6.1
      . org.apache.maven.resolver/maven-resolver-util 1.6.1
      . org.apache.httpcomponents/httpclient 4.5.12
        . org.apache.httpcomponents/httpcore 4.4.13
        . commons-codec/commons-codec 1.11
      . org.apache.httpcomponents/httpcore 4.4.13
      . org.slf4j/jcl-over-slf4j 1.7.30
        . org.slf4j/slf4j-api 1.7.30
      . org.slf4j/slf4j-api 1.7.30
    . org.apache.maven/maven-resolver-provider 3.6.3
      . org.apache.maven/maven-model 3.6.3
        . org.codehaus.plexus/plexus-utils 3.2.1
      . org.apache.maven/maven-model-builder 3.6.3
        . org.codehaus.plexus/plexus-utils 3.2.1
        . org.codehaus.plexus/plexus-interpolation 1.25
        . javax.inject/javax.inject 1
        . org.apache.maven/maven-model 3.6.3
        . org.apache.maven/maven-artifact 3.6.3
        . org.apache.maven/maven-builder-support 3.6.3
        . org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
      . org.apache.maven/maven-repository-metadata 3.6.3
        . org.codehaus.plexus/plexus-utils 3.2.1
      X org.apache.maven.resolver/maven-resolver-api 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-spi 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-util 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-impl 1.4.1 :older-version
      . org.codehaus.plexus/plexus-utils 3.2.1
      . javax.inject/javax.inject 1
      X org.slf4j/slf4j-api 1.7.29 :older-version
    . org.apache.maven/maven-core 3.6.3
      . org.apache.maven/maven-model 3.6.3
      . org.apache.maven/maven-settings 3.6.3
        . org.codehaus.plexus/plexus-utils 3.2.1
      . org.apache.maven/maven-settings-builder 3.6.3
        . org.apache.maven/maven-builder-support 3.6.3
        . javax.inject/javax.inject 1
        . org.codehaus.plexus/plexus-interpolation 1.25
        . org.codehaus.plexus/plexus-utils 3.2.1
        . org.apache.maven/maven-settings 3.6.3
        . org.sonatype.plexus/plexus-sec-dispatcher 1.4
          X org.codehaus.plexus/plexus-utils 1.5.5 :older-version
          . org.sonatype.plexus/plexus-cipher 1.4
      . org.apache.maven/maven-builder-support 3.6.3
      . org.apache.maven/maven-repository-metadata 3.6.3
      . org.apache.maven/maven-artifact 3.6.3
        . org.codehaus.plexus/plexus-utils 3.2.1
        . org.apache.commons/commons-lang3 3.8.1
      . org.apache.maven/maven-plugin-api 3.6.3
        . org.apache.maven/maven-model 3.6.3
        . org.apache.maven/maven-artifact 3.6.3
        . org.eclipse.sisu/org.eclipse.sisu.plexus 0.3.4
        . org.codehaus.plexus/plexus-utils 3.2.1
        . org.codehaus.plexus/plexus-classworlds 2.6.0
      . org.apache.maven/maven-model-builder 3.6.3
      . org.apache.maven/maven-resolver-provider 3.6.3
      X org.apache.maven.resolver/maven-resolver-impl 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-api 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-spi 1.4.1 :older-version
      X org.apache.maven.resolver/maven-resolver-util 1.4.1 :older-version
      . org.apache.maven.shared/maven-shared-utils 3.2.1
        . commons-io/commons-io 2.5
      . org.eclipse.sisu/org.eclipse.sisu.plexus 0.3.4
        . javax.enterprise/cdi-api 1.0
          . javax.annotation/jsr250-api 1.0
          . javax.inject/javax.inject 1
        . org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
        X org.codehaus.plexus/plexus-component-annotations 1.5.5 :older-version
        X org.codehaus.plexus/plexus-classworlds 2.5.2 :older-version
        X org.codehaus.plexus/plexus-utils 3.0.17 :older-version
      . org.eclipse.sisu/org.eclipse.sisu.inject 0.3.4
      . com.google.inject/guice$no_aop 4.2.1
        . javax.inject/javax.inject 1
        . aopalliance/aopalliance 1.0
        . com.google.guava/guava 25.1-android
          . com.google.code.findbugs/jsr305 3.0.2
          . org.checkerframework/checker-compat-qual 2.0.0
          . com.google.errorprone/error_prone_annotations 2.1.3
          . com.google.j2objc/j2objc-annotations 1.1
          . org.codehaus.mojo/animal-sniffer-annotations 1.14
      . javax.inject/javax.inject 1
      . org.codehaus.plexus/plexus-utils 3.2.1
      . org.codehaus.plexus/plexus-classworlds 2.6.0
      . org.codehaus.plexus/plexus-component-annotations 2.1.0
      . org.apache.commons/commons-lang3 3.8.1
    . org.clojure/data.xml 0.2.0-alpha6
      . org.clojure/data.codec 0.1.0
    . org.clojure/tools.gitlibs 2.1.144
    . org.clojure/tools.cli 1.0.206
    . com.cognitect.aws/api 0.8.505
      . org.clojure/data.json 1.0.0 :newer-version
      . org.clojure/tools.logging 1.1.0
      . com.cognitect/http-client 0.1.106
        . org.clojure/core.async 1.3.610
        . org.eclipse.jetty/jetty-client 9.4.36.v20210114
          . org.eclipse.jetty/jetty-http 9.4.36.v20210114
          . org.eclipse.jetty/jetty-io 9.4.36.v20210114
            . org.eclipse.jetty/jetty-util 9.4.36.v20210114
        . org.eclipse.jetty/jetty-http 9.4.36.v20210114
          . org.eclipse.jetty/jetty-util 9.4.36.v20210114
          . org.eclipse.jetty/jetty-io 9.4.36.v20210114
        . org.eclipse.jetty/jetty-util 9.4.36.v20210114
      . org.clojure/data.xml 0.2.0-alpha6
      . org.clojure/core.async 1.3.610
        . org.clojure/tools.analyzer.jvm 1.1.0
    . com.cognitect.aws/endpoints 1.1.11.969
    . com.cognitect.aws/s3 811.2.858.0
    . javax.inject/javax.inject 1
  . mvxcvi/multihash 2.0.3
    . mvxcvi/alphabase 1.0.0
  . borkdude/edamame 0.0.11
    X org.clojure/tools.reader 1.3.4 :older-version
  . com.taoensso/nippy 3.1.1
    X org.clojure/tools.reader 1.3.4 :older-version
    . com.taoensso/encore 3.9.2
      X org.clojure/tools.reader 1.3.3 :older-version
      . com.taoensso/truss 1.6.0
    . org.iq80.snappy/snappy 0.4
    . org.tukaani/xz 1.8
    . org.lz4/lz4-java 1.7.1
  . lambdaisland/uri 1.11.86
  . babashka/fs 0.1.2
  . javax.xml.bind/jaxb-api 2.3.1
    . javax.activation/javax.activation-api 1.2.0
  . http-kit/http-kit 2.5.3

Stuart19:01:08

Thats running it in the folder with the deps.edn that only has the nextjournal/clerk entry

mkvlr19:01:35

thanks, though I’m not seeing a problem yet

mkvlr19:01:06

Thanks for the heads up! It works for the latest (released) sha on https://snapshots.nextjournal.com/clerk-demo/build/bd74d652a8dddbdddb42b62fe8043cf1f4b4e65d/notebooks/semantic.html so I think we just need to rebuild it using that

mkvlr19:01:03

@U7CAHM72M did you see that hide-result now works with metadata? Though there should be no more cases now (I hope 🤞) where hiding the result is needed for performance reasons thanks to the new print budget

👍 1
Carsten Behring19:01:52

Do you think Clerk can be used for "meta programming" ? I used notebook to "programmatically" generate markdown which generates the html on rendering in notespace. Example: https://scicloj.github.io/scicloj.ml-tutorials/userguide-models.html Every "block" (= the documentation of a model) is autogenerated from "data".

mkvlr19:01:11

I think this should work.

mkvlr19:01:16

one of the next things I want to try & build is a var viewer that generates a different view of a namespace, more like what codox or cljdoc generate.

mkvlr19:01:54

you can certainly generate markdown, code & other things programmatically

Carsten Behring19:01:26

Exactly. Which precie markdown dialect does (clerk/md) support ?

mkvlr19:01:30

though there’s a small known issue where the code viewer when generated right now doensn’t quite have the right size:

mkvlr19:01:09

we use https://markdown-it.github.io as a markdown parser

mkvlr19:01:34

and we’re working on https://github.com/nextjournal/clerk/pull/62 to make the markdown rendering also completely customizable using the same viewer api. One of the goals is allowing to e.g. switch to MathJax from KaTeX for maths but you can really do anything at that point.

Carsten Behring20:01:11

I will give it a try. It looks good, I specialy need support for tables.

👍 1
mkvlr20:01:40

please let me know how it goes

teodorlu21:01:33

Note - if you want to generate something that clerk can show, hiccup might be a better option. I find it's easier to generate data than strings.

💯 2
Carsten Behring22:02:55

Yes, I went for hiccup generation. It went well, porting was easy. Latest changes of Clerke and nested viewers made certain things possible.

👍 1
mkvlr20:01:54

Btw, I can really recommend setting up a hotkey for clerk/show! as described in https://github.com/nextjournal/clerk#editor-workflow. I prefer this to working via the file watcher.

👍 1
1
Carsten Behring20:01:47

I just converted a complex notespace file to clerk, and get this: Uncaught Error: No reader function for tag namespace

mkvlr20:01:29

(-> 'clojure.core find-ns pr-str read-string)

mkvlr20:01:09

isn’t that expected if you have a #namespace[,,,] in there?

Carsten Behring20:01:12

It could be that somehwere my clojure code prints a namespace... but how to find it

mkvlr20:01:26

printing shouldn’t be a problem

Carsten Behring20:01:43

rendering I meant

mkvlr20:01:51

no, that should be fine

mkvlr20:01:04

do you get a stacktrace?

Carsten Behring20:01:52

I will try the big file piece-by-piece.

Carsten Behring20:01:10

If I find issues, I let you know.

🙏 1
Carsten Behring21:01:00

I found an issue converting a techml dataset into a list of maps and try to render this via clerk/table This only works by explicitly converting the "reified" result to seq:

Carsten Behring21:01:26

It does not happen always....

Carsten Behring21:01:31

Not on any dataset object I mean.

mkvlr21:01:46

interesting…

mkvlr21:01:05

what happens if you don’t convert it? Should work without the as-maps call I think?

mkvlr21:01:51

and isn’t ds/info a description of the dataset?

mkvlr21:01:32

is this a publicly available dataset so I can repro?

Carsten Behring21:01:14

It happens after a "second" rendering.

Carsten Behring21:01:29

so I think the "cache" does something with it.

Carsten Behring21:01:44

I think you can reproduce it with any tech.ml.dataset But it is not on every rendering. It has something to do with the cache,

Carsten Behring21:01:03

Putting "seq" before clerk/table fixes is reliably.

mkvlr21:01:26

cool, thanks, I'll see what's going on there tomorrow

mkvlr16:01:44

where can I find the api docs for tc/rows?

mkvlr16:01:52

I’m not sure there’s something actionable there besides changing tc/rows to return something that can be read (if the goal is to display it in a Clerk table)

mkvlr16:01:33

but given the raw dataset works I don’t see what the benefit would be

Carsten Behring21:01:26

I have a clear notbook which def's a variable 2 times , and uses it: (def a 1) ... ... (def a 2) (+ a 1) I had the impressions that sometimes it renders 2 and sometimes 3. Is this fully supported by the dependency management ?

mkvlr08:01:41

not supported with caching, yet. Also multiple defs in a block isn’t yet supported:

(do (def a 1) (def b 2))

mkvlr08:01:31

for the latter case we’re at least logging a warning already

Carsten Behring21:01:03

This can result in hard to debug wrong calculations. Can we at least detect the first case as well and warn.

mkvlr21:01:21

sure, could you file an issue?

mkvlr20:01:17

Thank you!