cljdoc

https://cljdoc.org/ & https://github.com/cljdoc/cljdoc
mccraigmccraig 2020-12-23T11:05:14.193100Z

i'm seeing an analysis failure with no errors - https://cljdoc.org/builds/38385 - when i try running the analyzer locally

clojure -Sdeps '{:deps {cljdoc/cljdoc-analyzer {:git/url "<https://github.com/cljdoc/cljdoc-analyzer.git>" :sha "9ff24dd10772b5c95d33d1c93c866a9e38884c17"}}}' -m cljdoc-analyzer.main analyze \
  --project cc.qbits/alia-all --version "5.0.0-alpha2-SNAPSHOT" \
  --output-filename "cc-qbits-alia-all-5.0.0-alpha2-SNAPSHOT.edn" \
  --exclude-with :no-doc \
  --exclude-with :skip-wiki \
  --extra-repo "clojars <https://repo.clojars.org/>" \
  --extra-repo "central <http://central.maven.org/maven2/>"
i see a similar failure with nothing logged to STDOUT or STDERR anyone have any clues on how to debug this ?

lread 2020-12-23T14:18:23.193400Z

I can take a peek @mccraigmccraig

lread 2020-12-23T14:30:25.195Z

@mccraigmccraig, First guess: It likely has to do with https://github.com/mpenet/alia’s use of modules. Have you read cljdoc docs on https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/for-library-authors.adoc#module-support?

lread 2020-12-23T14:39:12.196800Z

And.. there might be something fishy with the modules too? If I try to run the analyzer on cc.qbits/alia-joda-time version 5.0.0-alpha1 it seems to be referencing version 5.0.0 of alia which is not up on clojars.

mccraigmccraig 2020-12-23T14:40:10.197900Z

ah, yeah - there was an error in the deps ... it's fixed now, but clearly i need to do another release

mccraigmccraig 2020-12-23T14:40:52.198400Z

ok, that's a couple of things to run with ... thanks for the pointers @lee

lread 2020-12-23T14:43:19.199500Z

https://github.com/metosin/reitit is a great reference for a project with with modules https://cljdoc.org/d/metosin/reitit/0.5.10/doc/introduction. It’s https://github.com/metosin/reitit/blob/master/doc/cljdoc.edn might be of particular interest to you.

lread 2020-12-23T14:44:40.201Z

Also… don’t forget to make sure scm gets setup appropriately in your pom.xml so that cljdoc can fetch and display your docs.

lread 2020-12-23T14:46:49.203200Z

After addressing those issues, and if you are still running into probs, come on back with more Qs!

mccraigmccraig 2020-12-23T14:48:00.204Z

awesome, thanks @lee - i found https://github.com/cljdoc/cljdoc/blob/master/doc/running-cljdoc-locally.adoc too, so hopefully that will help

lread 2020-12-23T14:50:35.206100Z

Yeah, I recently reworked that doc, feedback is always appreciated!

mccraigmccraig 2020-12-23T16:23:17.208Z

should i be able to run an ingest locally on the multi-module project if all the deps are only installed in my local repo @lee? i've added :scm keys to all modules and a doc/cljdoc.edn and i'm getting a very similar failure locally to that i was seeing on cljdoc circleci : https://gist.githubusercontent.com/mccraigmccraig/642198b30a0c8a28e61dc35b1d1d66dd/raw/f526a995eba994154907c1251d7626332cbaea7c/failed%2520local%2520cljdoc%2520alia%2520ingest

lread 2020-12-23T16:26:29.208600Z

I’m not sure I ever tried a module project locally. Lemme check…

mccraigmccraig 2020-12-23T16:27:26.209300Z

i also tried it without the explicit jar/pom paths, and it retrieved them from the local repo ok... updated the gist to show that

lread 2020-12-23T16:31:00.210100Z

I just tried

clojure -m cljdoc-analyzer.main analyze \
  --project metosin/reitit --version "0.5.10" \
  --output-filename "/tmp/erp.edn" \
  --exclude-with :no-doc \
  --exclude-with :skip-wiki 
And that worked fine… so that’s reassuring.

lread 2020-12-23T16:31:11.210300Z

Lessee…

mccraigmccraig 2020-12-23T16:34:52.211400Z

yes, exactly

mccraigmccraig 2020-12-23T16:35:18.211900Z

using ../cljdoc/script/cljdoc rather than docker

lread 2020-12-23T16:35:19.212Z

cool

mccraigmccraig 2020-12-23T16:35:52.212500Z

i'll try ingesting reitit too, as a test of my local setup

lread 2020-12-23T16:36:04.212700Z

good idea

lread 2020-12-23T16:39:58.213900Z

It’s kind of a horrible error message, that we deliver for this scenario! :simple_smile: Have you setup your doc/cljdoc.edn?

lread 2020-12-23T16:42:11.214400Z

The :cljdoc/include-namespaces-from-dependencies would be important for alia

mccraigmccraig 2020-12-23T16:43:20.214700Z

yep, doc/cljdoc.edn is there - https://github.com/mpenet/alia/blob/master/doc/cljdoc.edn

lread 2020-12-23T16:48:18.215400Z

I’m comparing your cljdoc.edn to the one in reitit…

lread 2020-12-23T16:50:19.216100Z

Reitit is listing what look like maven coords, and I think you might be listing namespaces?

mccraigmccraig 2020-12-23T16:50:45.216300Z

ohhhh

mccraigmccraig 2020-12-23T16:51:00.216500Z

:man-facepalming:

lread 2020-12-23T16:51:55.217700Z

It’s not entirely clear from our docs what to list, we should certainly add a tip/note.

mccraigmccraig 2020-12-23T16:52:09.218Z

clearly i read that key :cljdoc/include-namespaces-from-dependencies and though "aha, this is a list of namespaces" , without looking carefully at what reitit had done

lread 2020-12-23T16:52:33.218500Z

yeah, I can see why you (and others) might do that!

lread 2020-12-23T16:53:44.219500Z

I don’t think there are a ton of projects on cljdoc that use modules, so while you might be going through a bit of pain here, we’ll end up at least improving our docs!

lread 2020-12-23T16:55:45.220200Z

I sense extreme success for alia on cljdoc on the horizon. :simple_smile:

mccraigmccraig 2020-12-23T17:01:27.220500Z

darn, nope. same error 😞

mccraigmccraig 2020-12-23T17:02:24.221100Z

when i ran the analyzer directly on reitit, it is successful

mccraigmccraig 2020-12-23T17:04:04.222Z

but it still fails on alia, so it is some attribute of the alia project which is causing the issue

lread 2020-12-23T17:04:35.223Z

oh right… I tried the analyzer rather than ingest on reitit. Did you successfully ingest reitit?

mccraigmccraig 2020-12-23T17:05:07.223600Z

i also tried ingest (on reitit-parent which is the multimodule project) - it seemed to succeed

lread 2020-12-23T17:10:27.224200Z

So you’ve installed all your modules to your local maven repo?

mccraigmccraig 2020-12-23T17:10:37.224400Z

yes

lread 2020-12-23T17:11:41.225300Z

Is everything currently pushed to alia? Maybe I can diagnose. I’ll need the command to install to local repo.

mccraigmccraig 2020-12-23T17:12:46.225800Z

everything is currently pushed. to install, lein sub install ; lein install should do the trick

mccraigmccraig 2020-12-23T17:13:51.227Z

you could try lein test, but unless you have a cassandra instance on localhost:9042 that will fail... although it will fail after loading namespaces, so you should be able to see that all the submodules were installed correctly

lread 2020-12-23T17:14:35.227500Z

cool, won’t run the tests, but will install and try to see what’s up

mccraigmccraig 2020-12-23T17:15:02.227700Z

thanks @lee

lread 2020-12-23T17:23:05.228Z

ok… good, I am seeing the same error as you.

mccraigmccraig 2020-12-23T17:23:58.228200Z

phew 🙂

lread 2020-12-23T17:36:19.229800Z

still poking around… starting with one of your modules… which oddly does not seem to analyze either.

mccraigmccraig 2020-12-23T17:39:20.231800Z

don't know if this is relevant - when i ran vanilla codox i had to do some :exclusions messing to get it to run - there were asm clashes between one of codox's deps and com.datastax.oss/java-driver-core-shaded

mccraigmccraig 2020-12-23T17:40:02.232300Z

com.datastax.oss/java-driver-core-shaded is a dep of the "main" module cc.qbits/alia

mccraigmccraig 2020-12-23T17:41:08.233100Z

once i excluded all the asm from com.datastax.oss/java-driver-core-shaded, and let codox have its own preferred version, it worked ok

lread 2020-12-23T17:45:05.233700Z

that might be relevant, but first…

lread 2020-12-23T17:47:38.235300Z

it seems that cljdoc does understand the use of dependencyManagement in a pom.xml. If I explicitly put versions in dependencies I can successfully locally ingest cc.qbits/alia-joda-time

mccraigmccraig 2020-12-23T17:49:11.236900Z

doh! lol, i only put the dependencyManagement stuff in yday - it cleaned up all the project.cljs quite a lot

mccraigmccraig 2020-12-23T17:50:16.237700Z

ok, so i'll have to get rid of the dependencyManagement for the moment then... should i file a ticket against https://github.com/cljdoc/cljdoc-analyzer ?

lread 2020-12-23T17:51:25.238700Z

But… reitit uses :managed-dependencies in its project.clj

mccraigmccraig 2020-12-23T17:51:58.239400Z

interesting

lread 2020-12-23T17:52:15.239800Z

But always specifies a version on :dependencies ?

lread 2020-12-23T17:54:05.241200Z

So maybe there is some partial advantage to use :managed-dependencies? Not a lein guy, dunno.

mccraigmccraig 2020-12-23T17:57:23.244Z

i'm looking in pom.xml for metosin/reitit and its not got any version against the &lt;dependencies&gt; , only against the &lt;dependencyManagement&gt;

lread 2020-12-23T17:59:31.244500Z

Huh, right you are…

mccraigmccraig 2020-12-23T18:00:48.244700Z

but...

lread 2020-12-23T18:01:45.245900Z

maybe only for his modules?

mccraigmccraig 2020-12-23T18:01:59.246Z

all the <dependencies> in the top level metosin/reitit-parent project do seem to have versions

mccraigmccraig 2020-12-23T18:02:57.246800Z

ok, well i think i can add explicit versions for all the top-level deps easily enough

lread 2020-12-23T18:04:12.247200Z

hmmm… I don’t think we’ve figure it out yet.

mccraigmccraig 2020-12-23T18:06:12.247500Z

2020-12-23 18:05:58,931 INFO cljdoc-analyzer.runner - Analysis succeeded.

lread 2020-12-23T18:10:12.248500Z

oh… if I remove the explicit dep on org.clojure/clojure in the pom, I have success for cc.qbits/alia-joda-time

lread 2020-12-23T18:11:15.249300Z

So… I currently think I might have been wrong about dependencyManagement

mccraigmccraig 2020-12-23T18:12:47.250200Z

i've added explicit versions to all the <dependencies> and now i'm passing analysis and ingest seems to be working

lread 2020-12-23T18:13:28.250900Z

ok, I’m not sure of the root cause, but if you are happy, I am happy.

mccraigmccraig 2020-12-23T18:14:07.251700Z

not 100% sure yet - how do i see the results on the local server ? when i search on localhost:8000 , it seems to hit the remote api ?

lread 2020-12-23T18:15:48.252400Z

Yep!

lread 2020-12-23T18:16:23.252700Z

Did your docs import?

mccraigmccraig 2020-12-23T18:16:31.253Z

although i'm not seeing any namespaces 😞

mccraigmccraig 2020-12-23T18:16:43.253200Z

just the README

lread 2020-12-23T18:16:53.253500Z

goodness gracious

lread 2020-12-23T18:17:25.253800Z

so the import of your modules did not work, I guess.

mccraigmccraig 2020-12-23T18:18:00.254300Z

no, but it crashed less hard than previously

lread 2020-12-23T18:18:09.254700Z

baby steps

mccraigmccraig 2020-12-23T18:18:19.254900Z

i will now see what happens if i put explicit versions in all the module dependencies

lread 2020-12-23T18:18:46.255400Z

from what I see on reitit, that should not be necessary… but…

mccraigmccraig 2020-12-23T18:19:53.256300Z

it's worth a try, it's the only action which has shown any progress at all so far

lread 2020-12-23T18:23:51.257500Z

Ok, FWIW, here’s an observation: If I add an explicit version only to org.clojure/clojure in your poms I am getting success.

lread 2020-12-23T18:24:02.257800Z

At least on the two modules I tried it on.

mccraigmccraig 2020-12-23T18:27:54.258100Z

analysis success, or you can see the API docs ?

lread 2020-12-23T18:28:10.258400Z

ingest success

mccraigmccraig 2020-12-23T18:28:36.259Z

yeah, i'm getting ingest success, can't see any API docs though

lread 2020-12-23T18:29:36.259800Z

still working on root cause of original failure… There’s something that does not like a versionless org.clojure/clojure dep.

lread 2020-12-23T18:30:11.260100Z

ok, I’ll move on… have you pushed your changes?

mccraigmccraig 2020-12-23T18:32:46.260300Z

not yet...

lread 2020-12-23T18:38:35.261400Z

Not to overwhelm you but you’ll probably want to be more specific with your scm . So that cljdoc can point back to the correct revision on github.

lread 2020-12-23T18:38:54.261700Z

(Unrelated to your current issue.)

mccraigmccraig 2020-12-23T18:40:48.262100Z

np, not overwhelmed yet 🙂

mccraigmccraig 2020-12-23T18:41:31.263Z

i just pushed changes to add explicit versions everywhere... i also added a scope to all the org.clojure/clojure deps

lread 2020-12-23T18:49:27.265Z

oh. I see. gotta ingest all modules when testing locally

mccraigmccraig 2020-12-23T18:49:49.265500Z

oh... got to ingest them in dependency order ?

lread 2020-12-23T18:49:57.265700Z

cljdoc is consulting its db for modules at render time.

lread 2020-12-23T18:50:28.266400Z

order is unimportant. Modules that are not ingested won’t show up under namespaces.

lread 2020-12-23T18:51:35.267200Z

In production this would just happen automatically after the first cljdoc load.

mccraigmccraig 2020-12-23T18:51:50.267600Z

oh - w00t - i ingested a module, and re-ran the top-level, and now i see API docs 😃

lread 2020-12-23T18:52:06.267800Z

sweet!

lread 2020-12-23T18:55:25.269200Z

So only known thing left is your scm tag. https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/faq.md#how-do-i-set-scm-info-for-my-project

mccraigmccraig 2020-12-23T18:56:21.269700Z

i already added that - https://github.com/mpenet/alia/blob/master/project.clj#L4

mccraigmccraig 2020-12-23T18:56:38.270100Z

and in all the modules too...

mccraigmccraig 2020-12-23T18:57:20.270700Z

it was coming through to the pom.xml last i looked

lread 2020-12-23T18:58:48.271400Z

hmm… maybe lein does something different for local install than for deploy?

lread 2020-12-23T18:59:25.271900Z

If I look at a reitit pom I see

&lt;scm&gt;
    &lt;url&gt;<https://github.com/metosin/reitit>&lt;/url&gt;
    &lt;connection&gt;scm:git:<git://github.com/metosin/reitit.git&lt;/connection>&gt;
    &lt;developerConnection&gt;scm:git:<ssh://git@github.com/metosin/reitit.git&lt;/developerConnection>&gt;
    &lt;tag&gt;e27d5c02138fd129280bcd1d18c49ac2067f93fc&lt;/tag&gt;
  &lt;/scm&gt;

lread 2020-12-23T19:00:25.272800Z

Oh no wait yours seems fine now, I must have been looking at an earlier version that only had url

mccraigmccraig 2020-12-23T19:01:04.273500Z

cool - yeah, i added it after you first said way back when

lread 2020-12-23T19:01:23.273900Z

ah! good stuff!

lread 2020-12-23T19:01:36.274100Z

so, extreme success?

mccraigmccraig 2020-12-23T19:02:55.274700Z

looking that way ... i'm just seeing how much duplication i can get rid of in the metadata, then i'll try a new release

mccraigmccraig 2020-12-23T19:03:13.275200Z

thank you for all the help @lee - do you need an issue submitting on gh ?

mccraigmccraig 2020-12-23T19:06:25.277Z

ok, i note that metosin/reitit has no org.clojure/clojure deps at all in its modules - which also avoids the issue - so, i think i'll follow that pattern, rather than have a hard-coded version in each module

lread 2020-12-23T19:08:53.278800Z

So… what did we uncover? 1. docs on :cljdoc/include-namespaces-from-dependencies could use more guidance 2. docs on running locally should mention that you’ll need to ingest all your modules 3. there is something up with having org.clojure/clojure under dependencyManagement and then versionless under dependencies Anything else?

lread 2020-12-23T19:10:55.280300Z

I’ll hit 1 and 2 today. Not sure what to do about 3. Is it a Clojure thing? Or a cljdoc thing?

mccraigmccraig 2020-12-23T19:22:45.282Z

i thought versionless under dependencies is the point of dependencyManagement - so you can specify a single version once across multiple libs, and i presumed its a maven feature rather than anything specifically clojure

mccraigmccraig 2020-12-23T19:23:29.282900Z

but that's just my impression, i haven't really looked at it beyond reading some docs which suggested it as a way of reducing duplication and inconsistency

lread 2020-12-23T19:25:18.284500Z

Yeah, in maven/java world it works fine. Don’t know root cause. I might poke around a small bit.

mccraigmccraig 2020-12-23T19:27:06.285200Z

it's interesting that the issue is only on the org.clojure/clojure dep - i've just removed the version from another dependency and it seems to analyse fine

lread 2020-12-23T19:29:00.285400Z

weird huh?

mccraigmccraig 2020-12-23T19:31:31.286Z

the thing i think is a (maybe indirect) cljdoc issue is that there was no useful error message

lread 2020-12-23T19:32:59.286600Z

oh right! ya, so when there were no resolvable deps cljdoc got very mysterious with us.

lread 2020-12-23T19:34:19.287400Z

So if I am right about the indirect cause, an error message like “no dependencies found” might have been helpful.

lread 2020-12-23T19:36:10.287900Z

I think it should be easy to setup a small reproducible project for that.

lread 2020-12-23T19:36:41.288300Z

I can log that one.

mccraigmccraig 2020-12-23T20:28:40.289600Z

yes, something which gives some basis for experimentation - if i had gotten any inkling that it was something to do with the org.clojure/clojure dep and version i would probably have tried removing it and figured out a path to success

lread 2020-12-23T20:33:22.290100Z

@mccraigmccraig, here’s what I came up with for an issue: https://github.com/cljdoc/cljdoc-analyzer/issues/34

mccraigmccraig 2020-12-23T20:38:02.290600Z

yep, that covers it all i think @lee

mccraigmccraig 2020-12-23T20:38:24.291100Z

thanks again for your help - i doubt i would have gotten a solution without it

lread 2020-12-23T20:44:28.291800Z

My pleasure @mccraigmccraig, thanks for uncovering some interesting problems!

lread 2020-12-23T21:14:11.292500Z

@mccraigmccraig docs have been improved/clarified a bit around sub modules: https://github.com/cljdoc/cljdoc/commit/cd97bbf7d763c13949ce6c26ea74d89b1c2ba9ed

mccraigmccraig 2020-12-23T21:30:49.292900Z

i think that covers it @lee

👍 1