deps.edn merge

This notebook demonstrates how to mount and use your Clojure projects but still pull in extra libraries that you might want to use in your runtime. We will pull in a library (see the Github component below) and also add compliment so that code completion is also available.

This repo is mounted by: second approach, first approach

First approach

Here we simply add a toplevel deps.edn file that points to our library via :local/root and in which we also include compliment .

{:deps {compliment {:mvn/version "0.3.10"}
        codn/codn {:local/root "./codn"}}}
deps.edn
Extensible Data Notation
(require '[codn.parser.core :as parser])
1.8s
first approach (Clojure)
nil

One can check that code completion is available for the libraries pulled in.

(parser/parse-string "(defn id [x] x)")
0.1s
first approach (Clojure)
Map{:head: :list, :body: Vector(4)}

I think this approach is suited when you want to pull in extra dependencies and maybe multiple libraries/projects via the Github mount that are independent of one another.

Second approach

In this approach we set the working directory of the runtime to /codn and also mount the deps2.edn below, under /root/.clojure/deps.edn . This takes advantage of the cross-project deps.edn configuration of the Clojure CLI. Be aware that the project (codn in our case) deps.edn takes precedence over the cross-project config.

{:deps {compliment {:mvn/version "0.3.10"}}}
deps2.edn
Extensible Data Notation
(require '[codn.parser.core :as parser])
1.8s
second approach (Clojure)
nil
(parser/parse-string "(defn id [x] x)")
0.1s
second approach (Clojure)
Map{:head: :list, :body: Vector(4)}

I think this approach is better suited if you are mainly working with one repository that might also have some resources that are necessary. This approach also lets one mount other Github repositories that are :local/root dependencies of your main repository. For this latter case the first approach will fail.

Runtimes (2)