metasoarous / oz

Data visualizations in Clojure and ClojureScript using Vega and Vega-lite
Eclipse Public License 1.0
829 stars 74 forks source link

Make clojupyter an optional dep, not provided #158

Closed mainej closed 3 years ago

mainej commented 3 years ago

As of tools.deps.alpha 0.9.745, when generating a pom it is possible to mark a dependency as <optional>true</optional>. This is similar to <scope>provided</scope> in that it indicates that the user of the library must arrange for the dependency to be on the classpath. However, the semantics of "optional" are more that this dependency is only sometimes needed.

This patch replaces the various hacks that marked clojupyter as provided with an indication that it is optional. This should have the desired effect of letting tooling like cljdocs load clojupyter, while still keeping clojupyter out of the dependency trees of oz users, unless they explicitly add it.

I discovered this while having similar problems with cljdocs in a different library. I had ran across some threads that led to oz and figured I'd pass along this fix.

Obviously, if you merge this, you'll want to ensure that:

  1. You're deploying with a recent version of the Clojure CLI, so that clojure -Spom respects :optional true, and,
  2. That I'm right that cljdocs can build while clojupyter is kept out of transitive dependencies. ;)
metasoarous commented 3 years ago

Amazing! Thanks so much for both letting me know, and submitting a PR!

I remember hearing that something like this was on the way. Very happy to have this fixed.

Thanks again!