This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-25
Channels
- # announcements (30)
- # beginners (4)
- # calva (173)
- # cider (22)
- # clj-kondo (12)
- # clojure-austin (2)
- # clojure-brasil (1)
- # clojure-europe (56)
- # clojure-korea (1)
- # clojure-nl (1)
- # clojure-norway (53)
- # clojure-uk (5)
- # clojurescript (25)
- # data-science (82)
- # hyperfiddle (87)
- # introduce-yourself (11)
- # jobs-discuss (44)
- # malli (4)
- # off-topic (7)
- # pedestal (8)
- # re-frame (16)
- # releases (1)
- # shadow-cljs (41)
- # slack-help (5)
- # sql (1)
- # squint (1)
Hi all --very basic Clay question (copying the organization of a basic scicloj notebook to kick the tires on it, with a dev ns that generates an HTML): • My namespace code appears, but no code below it is either shown or evaluated (either defs of local things to input or analyze, or defns of analysis functions). The only stuff below the ns declaration are some random commented out code lines for WIP functions. • I've got clay, kind, and kindly all in my require. • I did cargo cult copy the following just to see if this enabled making the code appear, to no avail.
^:kindly/hide-code
(def md (comp kindly/hide-code kind/md)
Is there somewhere else that's now a common VSCode/Calva default that would normally hide stuff? I haven't otherwise set any kindly advice anywhere. My goal is to see all my definitions in a notebook and work interactively with itHi. Do you see any error at the REPL?
The Calva setup described here is supposed to work (except for changes in the demonstrated Noj library, but this is unrelated). https://scicloj.github.io/clojure-data-scrapbook/projects/visual-tools/clay-calva-demo-20231216 https://github.com/scicloj/clojure-data-scrapbook/tree/main/projects/visual-tools/clay-calva-demo-20231216
Would you like to share your deps.edn
, clay.edn
(if any), and namespace?
And what actions do you do in VSCode to render the page?
clay.edn is nonexistent
in a clay.clj
I run
(clay/make! {:format [:html]
:base-source-path "src/boston/"
:source-path ["parcel_analysis.clj"]
:base-target-path "docs"
:clean-up-target-dir true})
and my deps is still pretty boring and from clj-new, basically:
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.12.0-alpha5"}
org.clojure/data.csv {:mvn/version "1.1.0"}
ovid/ovid {:local/root "../ovid"}
Factual/geo {:local/root "../geo"}
aurelius/aurelius {:local/root "../aurelius"}
org.locationtech.jts.io/jts-io-common {:mvn/version "1.20.0-SNAPSHOT"}
org.locationtech.jts/jts-core {:mvn/version "1.20.0-SNAPSHOT"}
org.wololo/jts2geojson {:mvn/version "0.18.1"}
scicloj/tablecloth {:mvn/version "7.021"}
org.scicloj/clay {:mvn/version "2-alpha87"}
org.babashka/http-client {:mvn/version "0.3.11"}}
:aliases
{:run-m {:main-opts ["-m" "foo.parcel-analysis"]}
:run-x {:ns-default foo.parcel-analysis
:exec-fn greet
:exec-args {:name "Clojure"}}
:build {:deps {io.github.clojure/tools.build
{:mvn/version "0.9.6"}}
:ns-default build}
:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
io.github.cognitect-labs/test-runner
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}}}
:mvn/repos {"jts-snapshots" {:url ""
:releases {:enabled false}
:snapshots {:enabled true
:update :always
:checksum :warn}}
"releases" {:url ""},
"snapshots" {:url ""}}}
the ns def:
(ns foo.parcel-analysis
(:require [clojure.string :as clojure.string]
[clojure.tools.logging :as log]
[ovid.io :as oio]
[geo.crs :as gcrs]
[geo.jts :as gjts]
[geo.io :as gio]
[ovid.feature :as of]
[aurelius.jts :as ajts]
[tech.v3.dataset.io.csv :as csv]
[tech.v3.dataset :as ds]
[portal.api :as p]
[clojure.java.io :as io]
[tablecloth.api :as tc]
[babashka.http-client :as http]
[charred.api :as charred]
[charred.bulk :as bulk]
[scicloj.kindly.v4.kind :as kind]
[scicloj.kindly.v4.api :as kindly])
(:import (org.locationtech.jts.geom GeometryFactory
Geometry
LineString
PrecisionModel)
(org.locationtech.jts.algorithm MinimumAreaRectangle MinimumDiameter)
(org.locationtech.jts.operation.linemerge LineMerger)
(org.locationtech.jts.operation.buffer BufferParameters
OffsetCurveBuilder)))
Thanks! That is very helpful. I'll try to reproduce in my environment.
It is great help to get real-world examples, especially those which break unexpectedly.
The only thing I can currently imagine is that many of these def'd things are geojsons weighing hundreds of MB -- there's nothing specific to display, but maybe it's crossing some kind of threshold
(also as you can see I'm basically trying to wean myself off of the previous transducer based stuff and work toward using TMD for gis stuff, as discussed in zulip)
(I'm renaming the namespace foo.parcel-analysis
to boston.parcel-analysis
, assuming it is intended to match the file path.)
(and I'll use the Clojars versions of Ovid and Geo, assuming this is not a relevant difference)
it's all going to be irrelevant if i'm putting a tmd dataset as a base case, so i'm going to need a new base gis library
Ok, so a page with the ns definition is rendered.
Is it what you see too?
oh my goodness. it's totally my fault. i'm so used to having to put all my pieces of info as defs to avoid massive repl output that i'm realizing that i wasn't actually sticking anything to stdout
(ns boston.parcel-analysis
(:require [clojure.string :as clojure.string]
[clojure.tools.logging :as log]
[ :as oio]
[geo.crs :as gcrs]
[geo.jts :as gjts]
[ :as gio]
[ovid.feature :as of]
[aurelius.jts :as ajts]
[tech.v3.dataset.io.csv :as csv]
[tech.v3.dataset :as ds]
[ :as io]
[tablecloth.api :as tc]
[babashka.http-client :as http]
[charred.api :as charred]
[charred.bulk :as bulk]
[scicloj.kindly.v4.kind :as kind]
[scicloj.kindly.v4.api :as kindly])
(:import (org.locationtech.jts.geom GeometryFactory
Geometry
LineString
PrecisionModel)
(org.locationtech.jts.algorithm MinimumAreaRectangle MinimumDiameter)
(org.locationtech.jts.operation.linemerge LineMerger)
(org.locationtech.jts.operation.buffer BufferParameters
OffsetCurveBuilder)))
(def t (gcrs/create-transform 4326 2249))
(+ 1 1)
with (added quarto in just to be safe)
(clay/make! {:format [:quarto :html]
:base-source-path "src/boston/"
:source-path ["parcel_analysis.clj"]
:base-target-path "docs"
:clean-up-target-dir true})
yields(sorry, as you can see i made a parcel_analysis2.clj to avoid deleting my other junk but that shouldn't matter)
Interesting
I get the following:
which is probably what you hoped to see.
Emacs, but it should not matter.
I haven't tested it in Windows so much.
right, sorry -- was also poking around with portal so i forget what's dev environment dependent
That could make a difference
This is amazing help @U2B2YS5V0!
Any user surprise is the best insight I could hope for.
You are encouraging me to test it on Windows, hopefully later this week. I was not so careful in making file management generic enough, etc.
Do you use https://learn.microsoft.com/en-us/windows/wsl/about? I think I know another person with WSL who seems to be fine.
i haven't had to do windows only in like a decade. the more i think about it it's GOTTA be that
It should be solvable, but probably not today.
no hurry at all. i can just do it on my mac for now and poke around on my windows installation as time allows
thanks
(leaving the keyboard for a while)
perfect timing actually 🙏
Update -- also doesn't work on mac. I thought maybe it was local dependencies but removing those didn't seem to matter. Back to thinking it's something about a kindly advice setting hiding all the code.
(At first I was thinking I could just switch to clerk in the mean time, but that idea of a leaflet map is just so enticing...)
Interesting
Do you see any errors in the browser console?
Or the REPL?
:thinking_face:
(also -- not a big deal, but just as a note, the pom.xml for clay has https://github.com/org.scicloj/clay as the url, which means that the link from clojars to the repo is broken)
Thanks!
The 'make' ns is the main entry point. I suggest I'll share a minimal example with you, and we start debugging from there.
mkdir test1
cd test1
mkdir notebooks
cat > notebooks/scratch.clj
(ns scratch)
(+ 1 2)
^D
clj -Sdeps '{:deps {org.scicloj/clay {:mvn/version "2-alpha87"}}}'
(require '[scicloj.clay.v2.api :as clay])
(clay/make! {:source-path "notebooks/scratch.clj"})
Could you try this?
nice, let us think what might be the difference. maybe the next step could be something similar to the code we tried yesterday, but from the shell, without any editor involved.
If you use VSCode Calva, when you start the REPL (Jack In), the corresponding Clojure command appears in the Terminal
window.
In my environment, it looks like:
pushd /path/to/your/project ; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" ; popd
Maybe we'll learn something from what we see in your Calva environment.
In Emacs CIDER, there is something similar in the *Messages*
buffer. In my environment, it looks like:
[nREPL] Starting server via /usr/local/bin/clojure -J-XX:-OmitStackTraceInFastThrow -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0"} cider/cider-nrepl {:mvn/version "0.28.5"} refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
okey dokey. i still have no idea why the old clj-new project i shoved clay into wasn't working, but i successfully just made a smaller clay-only project with a notebook alongside, and am just shifting my data analysis in there. i feel like it's something about the project setup or namespace organization or something, rather than having a "notebook" where i separately work through things. though i have no evidence to back that up.
but it's working at least. if it breaks at some point i will let you know what conclusively did it. it works in vs code / emacs too
many thanks for these efforts, @U2B2YS5V0.