leiningen

Nim Sadeh 2024-01-18T01:29:05.647239Z

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"]]}})

2024-01-18T01:38:58.924089Z

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

Nim Sadeh 2024-01-18T01:40:28.964369Z

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

2024-01-18T01:41:22.225239Z

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

seancorfield 2024-01-18T02:14:00.530129Z

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

Nim Sadeh 2024-01-18T02:14:44.025429Z

lein test works, I am trying to run lein kaocha

seancorfield 2024-01-18T02:15:45.300189Z

You need to specify the :profile/dev profile

seancorfield 2024-01-18T02:16:24.513309Z

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

seancorfield 2024-01-18T02:18:25.070319Z

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

seancorfield 2024-01-18T02:18:55.678619Z

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

dpsutton 2024-01-18T03:21:12.041309Z

❯ 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

dpsutton 2024-01-18T03:21:25.539379Z

dpsutton 2024-01-18T03:22:01.726389Z

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

dpsutton 2024-01-18T03:22:58.575259Z

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.

dpsutton 2024-01-18T03:25:27.285359Z

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+

dpsutton 2024-01-18T03:27:02.958829Z

❯ 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)

dpsutton 2024-01-18T03:29:32.364879Z

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 Sadeh 2024-01-18T03:42:25.701309Z

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

dpsutton 2024-01-18T03:42:55.951409Z

can you post the output of running lein kaocha?

Nim Sadeh 2024-01-18T03:44:43.054159Z

$ 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

dpsutton 2024-01-18T03:47:34.507579Z

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 Sadeh 2024-01-18T03:54:57.818789Z

Nim Sadeh 2024-01-18T03:57:23.627739Z

$ 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

dpsutton 2024-01-18T03:57:53.040589Z

can you tell me what pwd is here?

Nim Sadeh 2024-01-18T03:58:37.675069Z

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

dpsutton 2024-01-18T03:58:47.500219Z

/tmp/check

Nim Sadeh 2024-01-18T04:00:17.668429Z

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

Nim Sadeh 2024-01-18T04:01:24.660789Z

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

dpsutton 2024-01-18T04:01:26.601529Z

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

Nim Sadeh 2024-01-18T04:01:32.798219Z

Ohhh

Nim Sadeh 2024-01-18T04:01:47.625329Z

$ 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"

dpsutton 2024-01-18T04:01:52.888629Z

ok. so that works

Nim Sadeh 2024-01-18T04:01:53.359269Z

From /tmp/check

dpsutton 2024-01-18T04:02:01.761799Z

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

Nim Sadeh 2024-01-18T04:02:29.713999Z

Yea that still is broken in the same way

Nim Sadeh 2024-01-18T04:02:35.806329Z

Same output as before

dpsutton 2024-01-18T04:02:50.190359Z

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

Nim Sadeh 2024-01-18T04:03:02.234429Z

That is correct

dpsutton 2024-01-18T04:03:10.783779Z

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

Nim Sadeh 2024-01-18T04:06:39.412279Z

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

2024-01-18T04:08:24.843019Z

What does the full report say?

2024-01-18T04:09:12.565829Z

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

Nim Sadeh 2024-01-18T04:10:25.428179Z