Fork me on GitHub
#leiningen
<
2024-01-18
>
Nim Sadeh01:01:05

I am struggling with installing https://cljdoc.org/d/lambdaisland/kaocha/1.87.1366/doc/2-installing and https://github.com/weavejester/environ in the same build. I am following the directions but it seems my Kaocha installation is being ignored, what am I doing wrong?

(defproject server "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [com.github.seancorfield/honeysql "2.5.1103"]
                 [environ "1.2.0"]
                 [clj-http "3.12.3"]
                 [clj-time "0.15.2"]
                 [cheshire "5.12.0"]
                 [org.clojure/tools.reader "1.3.7"]
                 [net.clojars.wkok/openai-clojure "0.14.0"]
                 [io.pinecone/pinecone-client "0.7.2"]
                 [ring/ring-core "1.11.0-alpha1"]
                 [ring/ring-jetty-adapter "1.8.2"]
                 [compojure "1.7.0"]
                 [ring-cors "0.1.13"]
                 [ring-json-response "0.2.0"]
                 [com.taoensso/timbre "6.3.1"]]
  :main ^:skip-aot server.core
  :plugins [[lein-environ "1.2.0"]]
  :target-path "target/%s"
  :aliases {"kaocha" ["run" "-m" "kaocha.runner"]}
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}
             :dev [:project/dev :profiles/dev]
             :project/dev {:dependencies [[lambdaisland/kaocha "1.87.1366"]]}})

hiredman01:01:58

Those are different files used by different, largely incompatible, tooling

Nim Sadeh01:01:28

Am I? following is instructions for environ (dark) and Kaocha (light), am I misreading that they're both talking about Leiningen/project.clj?

hiredman01:01:22

Sorry, it has been a long time since I've used lein now, and just saw the alias key and thought that didn't belong

seancorfield02:01:00

@U05D3EAA6FM how are you trying to run the tests? What command?

Nim Sadeh02:01:44

lein test works, I am trying to run lein kaocha

seancorfield02:01:45

You need to specify the :profile/dev profile

seancorfield02:01:24

Hmm, no :dev supposedly pulled that in...

seancorfield02:01:25

Sorry, been eight years since I used lein heavily... Profiles were always a weird area...

seancorfield02:01:55

Maybe @U45T93RA6 can help you when he is around...

dpsutton03:01:12

❯ lein with-profile +project/dev classpath
Warning: profile :profiles/dev not found.
I did this and it shows kaocha being downloaded and also on the classpath

dpsutton03:01:01

this is also true with lein classpath since i think dev is included by default

dpsutton03:01:58

and then i just ran lein kaocha and it worked

❯ lein kaocha
Warning: profile :profiles/dev not found.
WARNING: Did not load a configuration file and using the defaults.
This is fine for experimenting, but for long-term use, we recommend creating a configuration file to avoid changes in behavior between releases.
To create a configuration file using the current defaults and configuration file location, create a file named tests.edn that contains '#kaocha/v1 {}'.
WARNING: In :test-paths, no such file or directory: test
WARNING: No tests were found. This may be an issue in your Kaocha test configuration. To investigate, check the :test-paths and :ns-patterns keys in tests.edn.

dpsutton03:01:27

using your project.clj file but with all the deps removed. I added environ back in and it still “worked” except it gave an error because environ brought in clojure 1.8 and kaocha requries 1.9+

dpsutton03:01:02

❯ lein kaocha
Warning: profile :profiles/dev not found.
ERROR: Kaocha requires Clojure 1.9 or later.
And then adding Clojure 1.11.1 it works (no tests are found)

dpsutton03:01:32

do you have a file at ~/.lein/profiles.clj? I’m not sure how multiple :dev profiles are merged, but perhaps you have one in <project>/profiles.clj or ~/.lein/profiles.clj and it’s clobbering?

Nim Sadeh03:01:25

I don't have a ~/.lein/profiles.clj

dpsutton03:01:55

can you post the output of running lein kaocha?

Nim Sadeh03:01:43

$ lein kaocha --version
Can't find 'kaocha.runner' as .class or .clj for lein run: please check the spelling.
Execution error (FileNotFoundException) at user/eval140$fn (form-init14676761731919941110.clj:1).
Could not locate kaocha/runner__init.class, kaocha/runner.clj or kaocha/runner.cljc on classpath.

Full report at:
/var/folders/2p/5wjfhyyd6zqc9qw_gq9f1zx80000gn/T/clojure-12318744842917680805.edn

dpsutton03:01:34

can you make a new directory in your /tmp directory called check and make the file /tmp/check/project.clj with these contents:

(defproject server "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[environ "1.2.0"]
                 [org.clojure/clojure "1.11.1"]]
  :main ^:skip-aot server.core
  :plugins [[lein-environ "1.2.0"]]
  :target-path "target/%s"
  :aliases {"kaocha" ["run" "-m" "kaocha.runner"]}
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}
             :dev [:project/dev :profiles/dev]
             :project/dev {:dependencies [[lambdaisland/kaocha "1.87.1366"]]}})
and then run lein kaocha This setup works on my machine. And perhaps that can tell us. Also would love the full output of lein classpath

Nim Sadeh03:01:23

$ vim /tmp/check/project.clj
$ lein kaocha --version
Can't find 'kaocha.runner' as .class or .clj for lein run: please check the spelling.
Execution error (FileNotFoundException) at user/eval140$fn (form-init17859507483933356489.clj:1).
Could not locate kaocha/runner__init.class, kaocha/runner.clj or kaocha/runner.cljc on classpath.

Full report at:
/var/folders/2p/5wjfhyyd6zqc9qw_gq9f1zx80000gn/T/clojure-2284241369372617117.ed

dpsutton03:01:53

can you tell me what pwd is here?

Nim Sadeh03:01:37

Did you mean ~/tmp/check or /tmp/check?

Nim Sadeh04:01:17

And you wanted pwd in my project directory or /tmp/check? The latter is /tmp/check

Nim Sadeh04:01:24

The former is /Users/nsadeh/Dropbox/modeldiplomat/server

dpsutton04:01:26

i want to make sure that you are running lein kaocha from /tmp/check

Nim Sadeh04:01:47

$ lein kaocha --version
Warning: profile :profiles/dev not found.
WARNING: Did not load a configuration file and using the defaults.
This is fine for experimenting, but for long-term use, we recommend creating a configuration file to avoid changes in behavior between releases.
To create a configuration file using the current defaults and configuration file location, create a file named tests.edn that contains '#kaocha/v1 {}'.
lambdaisland/kaocha "1.87.1366"

dpsutton04:01:52

ok. so that works

Nim Sadeh04:01:53

From /tmp/check

dpsutton04:01:01

you have to run lein kaocha from the directory your project is in

Nim Sadeh04:01:29

Yea that still is broken in the same way

Nim Sadeh04:01:35

Same output as before

dpsutton04:01:50

cd ~/Dropbox/modeldiplomat/server`
lein kaocha
that doesn’t work though?

Nim Sadeh04:01:02

That is correct

dpsutton04:01:10

i’m confused. where did you run lein kaocha for the /tmp/check one? Why didn’t you run it from that directory

Nim Sadeh04:01:39

I am not sure I am getting this right. I ran lein kaocha twice, once from /tmp/check, and once from the project directory ~/Dropbox/modeldiplomat/server . The former resulted in Warning: profile :profiles/dev not found, and the latter resulted in Can't find 'kaocha.runner' as .class or .clj

hiredman04:01:24

What does the full report say?

hiredman04:01:12

It should have the entire stacktrace, which likely isn't useful, but you never know