Fork me on GitHub
#calva
<
2023-08-13
>
Ingy döt Net18:08:11

Can Calva jack-in to a lein based project that has github dependencies? I'm looking at using https://github.com/tobyhede/lein-git-deps but I'm open to any solution or best practice. Specifically I need https://github.com/faux-combinator/clojure/tree/master as a dep for my project

seancorfield18:08:09

Can you run lein repl from the terminal and verify the expected namespaces can be required? If so, then jack-in should work fine.

Ingy döt Net18:08:28

https://github.com/tobyhede/lein-git-deps talks about wanting a custom classpath (but not with lein 2 maybe?). I'll have to play around with it to see what it does.

seancorfield18:08:28

Like I say, if lein repl works and you can require namespaces from that faux-combinator library successfully, then jack-in should just work.

Ingy döt Net18:08:30

Is there not a standard way to use github repos for deps?

seancorfield18:08:40

Not for Leiningen, no.

2
seancorfield18:08:52

If you use the CLI and deps.edn, that supports git deps natively.

seancorfield18:08:22

(aside from helping beginners here, I haven't used Leiningen since 2015 🙂 )

Ingy döt Net18:08:45

well because you lead the alternative I should think 🙂

seancorfield18:08:21

We switched to Boot in 2015 and the CLI in 2018 at work. I am not part of the core Clojure team -- I just use the tools they provide 🙂

Ingy döt Net18:08:13

but you're the deps.edn go-to guy as I understand it

Ingy döt Net18:08:27

boot's dead, yes?

seancorfield18:08:01

Boot is pretty much dead, yes, but it was second to Leiningen for a while:grin:

seancorfield18:08:10

We have a big Polylith codebase (140k lines, 160 subprojects) so I tend to be able to help people with deps issues...

👍 2
Ingy döt Net18:08:56

The other folks I'm working with on this project prefer lein at this point. It would be nice if https://github.com/RickMoynihan/lein-tools-deps was up to date.

phill22:08:05

Thanks for the link to lein-git-deps, which I hadn't known about... Excellent artwork, but not a load-bearing part for reasons cited in the README. The README also gives very solid advice: > [Instead,] fork the project and package up your own release. Then, you can either deploy it on your local system with lein install, create a private Maven repository and publish it there, or publish it to Clojars with a different group-id. Which, of course, would also benefit all other Leiningen users. I think git dependencies are a good, noble, and worthy holy grail in the sense of freedom from the middleman. But I intend to hold off until deps.edn's developers have put down their pencils for the very last time. Bulid tools that are still evolving are a headwind for the hobbyist who wants to return periodically to dusty old projects and give them another half-turn of the screw. I am still smarting from the Lein 1 to Lein 2 transition, which must have been 8-10 years ago now.

Ingy döt Net00:08:01

@U0HG4EHMH Excellent commentary. Thanks!

Ingy döt Net00:08:17

Ironically the author of the particular unreleased dep is one of the people I'm working with on the project. In this case I'll just ask him to release it. But it's a problem worth solving.

seancorfield00:08:47

And yet git deps are a solved problem, supported as a first class procurer by the official Clojure CLI...

seancorfield01:08:58

FWIW, the ClojureCLR folks plan to support git deps too.

Ingy döt Net01:08:24

And yet I don't have a good answer for lein yet and @U0HG4EHMH doesn't have a final word, iiuc. I think it's great that tools-deps has solved it.

seancorfield01:08:17

TBH, I am a bit surprised and a bit disappointed that Leiningen hasn't moved with the times on this... But it's hardly been maintained at all for several years. All the work is happening around deps.edn these days.

Ingy döt Net01:08:09

Does the deps.edn :deps with a git repo support using a repo subdirectory besides the root one?

Ingy döt Net01:08:45

That would be a nice addition if not.

Ingy döt Net01:08:41

Can you do that with :deps and :paths ?

Ingy döt Net01:08:13

Looks like maybe :deps/root is my friend here

seancorfield01:08:52

Yes, that's how folks rely on Polylith for example.

👍 2
hifumi12305:08:59

Leiningen is more or less “complete” hence most activity being fixing bugs whenever they’re reported. There are plans for releasing Leiningen 3.0, though again, the functionality requested here is already available through a plugin. And like most feature requests to Leiningen, the functionality either already exists in core or is provided via a plugin. deps.edn wont work for this git repo since there isnt a deps.edn committed to the repo. Leiningen doesnt have this problem. It should be sufficient to set up a project like so

(defproject git-sample "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.11.1"]
                 [faux-combinator/clojure "cc6897c"]]
  :repositories [["public-github" {:url ""}]]
  :plugins [[reifyhealth/lein-git-down "0.4.1"]])
Tested locally

❤️ 2
seancorfield16:08:01

You don't need a deps.edn file in the git repo for tools.deps to be able to use it. You can specify the manifest type as :deps and it will assume an empty deps.edn file (if there are any other dependencies, you can specify those yourself, alongside the git dep you're trying to use.

👍 2
Ingy döt Net17:08:11

@U0479UCF48H Worked like a charm. Thanks!

Ingy döt Net17:08:52

And calva sees it fine after jacking in through lein, which was my original query 🙂