A simple CLI tool to easily managage dependencies for Clojure projects. Supports deps.edn
, Leiningen, Shadow-cljs and Babashka project configurations. It uses rewrite-clj and zprint under the hood to rewrite your configuration files.
The simplest way to add a dependency to a Clojure project is to first find the artifact coordinates. Then, depending on whether you use Leiningen or you need the Maven artifact coordinates, you look for that and add it to your configuration. There are a few tools to help ease this flow.
For one, there is clj -X:deps find-versions
, which downloads a bunch of jars on first start up and returns a bunch of versions. Some other tools include depot (the similar naming is coincidental), ancient-clj and neil, which also has other features, like adding common aliases.
While all of these tools have their own merits, they have their own drawbacks too, such as being slow to start up (all JVM based CLIs, including Depo for now), or only supporting edn
configuration files, or not having a CLI at all.
Depo aims to cover these bases.
Depo is still a work in progress. See the roadmap
To try Depo out, you can use this one liner:
clojure -Sdeps '{:deps {org.clojars.some/depo {:mvn/version "RELEASE"}}}' -M -m depo.core --help
Alternatively, you can add the following to your aliases:
{:depo {:extra-deps {org.clojars.some/depo {:mvn/version "RELEASE"}}
:main-opts [ "-m" "depo.core"]}
Now you can run clojure -M:depo --help
.
You can also use Depo as a library.
(ns example
(:require [depo.resolver :as r]))
(r/get-release-version "reagent") ;=> "1.2.0"
(r/conform-version "org.clojure/clojure") ;=> {:groupID "org.clojure", :artifactID "clojure", :version "1.5.0-alpha3"}
(r/version-exists? "org.clojure/clojure" "0.20.7") ;=> false
For more information, see the API documentation.
Depo can be built and installed as a native image:
- Install GraalVM
- Clone this repo
- Run
clj -T:build native-image
or, if you have babashka installed,bb native-image
- The binary is now in
target/
. Copy it to somewhere on your path.
To see a list of commands, run depo --help
.
Depo first looks for a config file in your current working directory in the following order:
deps.edn
project.clj
shadow-cljs.edn
bb.edn
It then uses first config file that it finds for its operations.
There are flags that you can set if you'd like to override the default behavior of the commands.
--file/-f
- Use a different config file instead of the default file Depo finds.
# simple usage
depo add org.clojure/clojure
# If the groupID and artifactID are the same, you can ommit the groupID
depo add reagent
# Use specific version
depo add [email protected]
# Use a different config file instead of default
depo -f bb.edn add metosin/malli
depo remove clj-http
# Updates a specific dependency
depo update metosin/malli
# Updates all dependencies
depo update
© 2023 Somē Cho