cljdoc

https://cljdoc.org/ & https://github.com/cljdoc/cljdoc
borkdude 2019-05-24T09:56:02.000900Z

nice work on the Docker image. I’ve been able to run it like this:

docker run --rm -p 8000:8000 cljdoc/cljdoc:0.0.1406-030763c
it’s probably still undocumented? it would be nice to have some pointers around: persisting state, importing local docs

borkdude 2019-05-24T09:56:39.001500Z

the DB migration could probably happen at build time, so it would save time at startup

borkdude 2019-05-24T09:56:55.001900Z

(nothing urgent, I was just playing with it)

martinklepsch 2019-05-24T09:58:12.003200Z

@borkdude yeah, that could probably be documented better

martinklepsch 2019-05-24T10:03:15.004400Z

I'm not entirely sure where it should go (maybe into running cljdoc locally) but if you put up the rough steps and instructions I'm happy to fill in any blanks that aren't clear

borkdude 2019-05-24T10:04:30.005600Z

I think “running cljdoc locally” makes sense yeah. Docker would probably be my first goto instead of trying to build all these npm deps

borkdude 2019-05-24T10:04:59.006300Z

I’ll first make an issue for this, so we can think about it a little bit

martinklepsch 2019-05-24T10:05:12.006500Z

should be just npm i; npm package or something right?

borkdude 2019-05-24T10:05:57.007500Z

yeah, but that requires npm, which not everyone uses (really, some people don’t do anything with front-end or JS). I think Docker is the path of least resistance without cluttering your machine with stuff

martinklepsch 2019-05-24T10:06:53.008500Z

We can also discuss the details in a PR, I think it would be fantastic to have a first cut that can be iterated upon 🙂

borkdude 2019-05-24T10:07:20.008800Z

👍

martinklepsch 2019-05-24T10:16:40.009300Z

Also... two small "announcements": - cljdoc is now linked to from every Clojars artifact page: https://clojars.org/rum - If you want to support my work on cljdoc you can sponsor me on GitHub: https://github.com/users/martinklepsch/sponsorship) For the entire first year GitHub will match your sponsorship! ‼️ 🙂

🎉 2
borkdude 2019-05-24T10:16:44.009700Z

https://github.com/cljdoc/cljdoc/pull/301

👏 2
borkdude 2019-05-24T10:17:16.010300Z

(the branch allows edits from maintainers, so feel free to push to this PR)

dominicm 2019-05-24T10:34:44.010900Z

Of course, some people don't want their machine cluttered with docker

borkdude 2019-05-24T10:35:07.011100Z

yeah, so more choices for everyone

borkdude 2019-05-24T15:12:36.011900Z

I’ve got something going:

docker run --rm -p 8000:8000 -v $HOME/Dropbox/dev/clojure/clj-kondo:/clj-kondo --entrypoint "clojure" cljdoc/cljdoc:0.0.1407-32d00ce -A:cli ingest -p borkdude/clj-kondo -v 2019.05.20-alpha-SNAPSHOT -g /clj-kondo
but it complains about :cause Requested version cannot be found in configured repositories: [borkdude/clj-kondo 2019.05.20-alpha-SNAPSHOT] Not sure what this is.

borkdude 2019-05-24T15:15:56.012300Z

it probably needs the jar to be in the .m2 directory? I’m not sure why since I’m ingesting a git repo?

borkdude 2019-05-24T15:26:59.013100Z

this didn’t help:

docker run --rm -p 8000:8000 -it -v $HOME/Dropbox/dev/clojure/clj-kondo:/clj-kondo -v $HOME/.m2:/root/.m2 --entrypoint "clojure" cljdoc/cljdoc:0.0.1407-32d00ce -A:cli ingest -p borkdude/clj-kondo -v 2019.05.20-alpha-SNAPSHOT -g /clj-kondo

borkdude 2019-05-24T15:27:26.013300Z

I’ll continue some other time

martinklepsch 2019-05-24T15:30:18.014400Z

Jars are always used for analysis. Git is only used for articles. Sorry for being terse, afk

borkdude 2019-05-24T15:30:50.015100Z

ah now I get it

martinklepsch 2019-05-24T15:30:52.015200Z

Try mounting your m2 into docker as well

borkdude 2019-05-24T15:31:06.015600Z

yes, that’s what I did, but I got my version wrong I think

borkdude 2019-05-24T15:33:41.016Z

cool, it worked

martinklepsch 2019-05-24T15:37:01.016500Z

Wohooo! :)

borkdude 2019-05-24T15:44:26.017300Z

Cool, after ingesting and preserving the sqlite data outside the container, and then running cljdoc, it worked 🙂 https://www.dropbox.com/s/3u4dm1timpi84b3/Screenshot%202019-05-24%2017.43.53.png?dl=0

borkdude 2019-05-24T15:45:24.017800Z

I’ll update the docs later, but it’s already described in the PR

martinklepsch 2019-05-24T15:45:58.018Z

🙌🙌

borkdude 2019-05-24T16:27:51.019500Z

am I right that cljdoc does not scan your local m2 directory for newer versions? if that were possible, then I could just ingest after I started the server, using the UI 🙂

2019-05-24T16:33:01.022800Z

I'm trying to follow the steps from https://cljdoc.org/d/cljdoc/cljdoc/0.0.1315-c9e9a7e/doc/running-cljdoc-locally. The muuntaja example works, but when I try to ingest my own lib, I get this during analysis:

Caused by: java.io.FileNotFoundException: Could not locate taoensso/encore__init.class or taoensso/encore.clj on classpath., compiling:(trident/util/core.cljc:1:1)
Earlier in the analysis output, I see:
Used dependencies for analysis:
org.clojure/clojure 1.9.0
  org.clojure/core.specs.alpha 0.1.24
  org.clojure/spec.alpha 0.1.143
trident/util /home/arch/.m2/repository/trident/util/0.1.1/util-0.1.1.jar
org.clojure/clojurescript 1.10.339
...
So my lib (`trident/util`) is included, but taoensso/encore (which my lib depends on) isn't. I'm assuming encore should be listed here, is that correct?

martinklepsch 2019-05-25T07:53:58.042600Z

not sure I understand 😄

martinklepsch 2019-05-25T07:55:20.042800Z

What we did before was just use :mvn/version and add that to the classpath. But when users passed a custom jar location (ie. something that would not be found when using :mvn/version) that caused problems. So now instead of depending on tools.deps to find the right jar we depend on the actual jar file the user provided: https://github.com/cljdoc/cljdoc/pull/276/files#diff-aee7953db795ae539bf8139b6e6b82a1

martinklepsch 2019-05-25T07:56:11.043Z

tools.deps supports resolving dependencies for jars like this (at least in the limited testing we did) and generally most libraries seem to be packaged in the way that is compatble with the way tools.deps handles this

martinklepsch 2019-05-25T07:56:43.043200Z

Maybe it would make sense for tools.deps to surface an error or warning if it can't resolve transitive dependencies of a jar but not sure

dominicm 2019-05-25T11:27:48.052500Z

Seems like there's multiple ways the pom can be found in different contexts

2019-05-24T16:36:19.023100Z

I would think the dependency on encore would've been picked up from the pom file, but apparently that's not happening. A difference I noticed between my lib and muuntaja is that the jar for my lib doesn't have anything under META_INF, so maybe cljdoc/codox depends on certain files being in there?

martinklepsch 2019-05-24T16:38:32.023600Z

You mean like actively scan in the background?

borkdude 2019-05-24T16:38:57.023800Z

I mean scan when you visit e.g.:

<http://localhost:8000/versions/clj-kondo/clj-kondo>

borkdude 2019-05-24T16:44:21.025500Z

A general remark about the scripts in cljdoc: it would be a lot easier if you assume that people will call the scripts from the root dir I think? No need to worry about ../.. and doing things like cd $(git rev-parse --show-toplevel)

martinklepsch 2019-05-24T16:44:29.025600Z

Dependencies are extracted from the Pom so if it’s in there it should be picked up

borkdude 2019-05-24T16:45:08.026800Z

but maybe there are reasons that it doesn’t work like that

martinklepsch 2019-05-24T16:45:10.027Z

I’m away from the computer right now but happy to help you out later

2019-05-24T16:45:48.027200Z

k thanks. I'm putting together a minimal example now and I'll let you know if I make any progress

borkdude 2019-05-24T16:49:20.028400Z

I updated the PR now, I think it’s pretty much ready 🙂

borkdude 2019-05-24T16:49:56.029800Z

one assumption in the updated README is that there is a Docker image with a latest tag on Dockerhub. I also updated the config for that

lread 2019-05-24T16:51:29.031500Z

cool to see docker option for testing locally! Is using docker locally a better option if I want to more closely match what happens in cljdoc production?

borkdude 2019-05-24T16:52:52.031800Z

I think it’s pretty much the same thing?

martinklepsch 2019-05-24T16:53:16.032300Z

Yeah, same thing

🤓 1
lread 2019-05-24T16:54:32.032700Z

cool! thanks!

dominicm 2019-05-24T18:29:06.033600Z

Hello, will fix anything that needs fixing 👋

dominicm 2019-05-24T18:30:03.033800Z

I guess we need to see the pom.xml for trident.util :)

dominicm 2019-05-24T18:30:39.034Z

If you run jar tf myjar.jar that output is useful

2019-05-24T18:32:40.034200Z

I actually just figured out the problem! if you include META-INF/pom.xml in the jar it works

2019-05-24T18:35:01.034400Z

not sure if this is expected behaviour or not (@martinklepsch?)

dominicm 2019-05-24T18:46:07.034700Z

That's exactly right!

dominicm 2019-05-24T18:46:20.034900Z

You need the pom for cljdoc to read the dependencies

2019-05-24T18:48:04.036Z

:thumbsup: Before I was assuming that the pom at (e.g.) ~/.m2/repository/io/dominic/super-duper-octo-barnacle/0.1.3/super-duper-octo-barnacle-0.1.3.pom would be used

martinklepsch 2019-05-24T18:48:36.036700Z

thats interesting, i think there was a PR recently that changed this, focusing on the Pom in the jar and not so much on the other Pom

dominicm 2019-05-24T19:25:51.036900Z

I see, interesting

dominicm 2019-05-24T19:29:42.037100Z

I would have thought they were equally valid?

martinklepsch 2019-05-24T19:32:21.038400Z

They are but tools deps supports resolving deps via a jar only too and so I think we switched to that. You can probably dig up the PR very easily

martinklepsch 2019-05-24T22:15:53.039Z

I think this is the relevant PR: https://github.com/cljdoc/cljdoc/pull/276

martinklepsch 2019-05-24T22:16:22.040Z

Please open an issue if the behavior discussed here should be considered a bug! :)