tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
2020-10-23T00:08:38.490400Z

i see the typo now. ugh. I should turn on a spell check before i post something to catch things like this.

alexmiller 2020-10-23T00:42:49.490700Z

On latest clj, you'll get: Error building classpath. No :mvn/version specified for com.datomic/ion

πŸ‘ 1
dominicm 2020-10-23T07:08:51.495800Z

Now that add-lib isn't functional, if I wanted to load dependencies for a particular function call with exec-opts (without the user having to know which dependencies to add to deps.edn for that call) how would I do that? I want to provide some beginner tools as part of something, but I don't want to bloat the primary use case. If I had bash-style exec, I'd probably just restart the jvm that way. I want the set of functionality to be an open-set though, so it might expand in the future, and the user shouldn't need to fiddle around to get that working. I'm certainly aiming for "easy" here.

dominicm 2020-10-23T07:24:05.496Z

Just looked at what ion does, that has ion-dev which you install in your user deps.edn, that strikes me as an odd choice.

Eamonn Sullivan 2020-10-23T08:30:03.499300Z

Good morning, does anyone use CircleCI with tools-deps and have an example I can see? I'm just exploring a few alternatives to our Jenkins. I use Github actions on my own stuff (e.g., https://github.com/eamonnsullivan/github-pr-lib I create for scripts and deploy to clojars) and I'm also going to take a look at AWS CodeBuild/Pipeline, but examples to study are mostly lien-based.

borkdude 2020-10-23T08:33:41.499700Z

@eamonn.sullivan Almost all of my projects do

Eamonn Sullivan 2020-10-27T13:39:25.120500Z

So, just to finish this thread off, in case anyone is still reading: I did eventually get it to work, providing the same functionality that I have (on other repos) using Github Actions, which was the goal. Thanks very much for the help and the pointers! https://github.com/eamonnsullivan/github-api-lib/blob/main/.circleci/config.yml

practicalli-john 2020-10-27T15:50:43.130Z

Thanks for sharing

Eamonn Sullivan 2020-10-23T08:34:06.499900Z

Ah, perfect. Thank you!

practicalli-john 2020-10-23T09:16:01.000400Z

@eamonn.sullivan There are images you can choose from that already have Clojure CLI tools included. http://practicalli.github.io/clojure/testing/integration-testing/circle-ci/ If you want the very latest version of Clojure CLI tools, then use Borkdude's approach (which I am going to add to that page I mentioned right now, as I want to use 1.10.1.727)

πŸ‘ 1
practicalli-john 2020-10-23T09:46:44.001Z

@eamonn.sullivan I have a collection of different approaches I'm going through in this ticket https://github.com/practicalli/clojure-content/issues/183 Would be interested to hear what you end up using. Thank you.

dominicm 2020-10-23T10:14:31.001300Z

I suppose this could be considered the ability to import deps.edn aliases into your project somehow :)

arohner 2020-10-23T11:09:43.002300Z

What is the recommended way to deploy a jar to a private S3 repo using tools.deps?

alexmiller 2020-10-23T11:17:23.003700Z

Putting ion-dev in user deps.edn is recommended - it’s a general tool for deploying ions

alexmiller 2020-10-23T11:20:27.006100Z

We will be updating add-lib to work again btw with some additional apis and ultimately in master

alexmiller 2020-10-23T11:21:05.007Z

But not sure I have a good answer for this use case right now

alexmiller 2020-10-23T11:23:15.007500Z

Yeah that doesn’t look right

dominicm 2020-10-23T11:44:11.007700Z

I also noticed that read-args uses a loop but could be mapv quite easily

dominicm 2020-10-23T11:46:22.007900Z

np. Maybe I'll start with bloat, then swap to add-lib later.

alexmiller 2020-10-23T11:52:40.008100Z

fixed the double throw

alexmiller 2020-10-23T12:05:28.008300Z

agreed on read-args - that stuff has been through a lot of versions where the positionality was more important, going to leave it for now as it's reasonably likely to go through more changes

dominicm 2020-10-23T14:08:52.008500Z

This seems like an argument against exec-opts to me: clj -X:user/new create :template "\"$PWD/template::new-app\"" :name my.project.name (this doesn't work for me, but that's unrelated, just the awkward way to pass in pwd)

alexmiller 2020-10-23T14:17:14.008800Z

what doesn't work?

alexmiller 2020-10-23T14:18:18.009100Z

and it's awkward because? quoting?

dominicm 2020-10-23T14:21:41.009200Z

@alexmiller I'm currently working on a main which will have exec-like uses, particularly the notion of updating a map in response to those args. Might be useful to rely on the exec code once it's stable. Then I can just point at your docs :p

dominicm 2020-10-23T14:23:12.009400Z

Obviously read-args is pretty simple, and so is the reduce itself. So maybe that's not really useful. But I'm not sure how it'll evolve. The tagged-literal reader might be subtle.

alexmiller 2020-10-23T14:23:43.009600Z

I would not rely on the exec code right now - I do not (yet) consider that to be "public api"

dominicm 2020-10-23T14:24:06.009800Z

@alexmiller yeah, the quoting is awkward, compare to main-style:

--template "$PWD/template::new-app"
Doesn't work because I'm passing wrong args to clj-new, but I didn't need that debugging.

alexmiller 2020-10-23T14:24:09.009900Z

I think it would actually be useful to move some or all of it into clojure itself (similar to clojure.main) but that's probably longer term

dominicm 2020-10-23T14:27:38.010400Z

Yeah, I saw it was all private and ducked out :)

seancorfield 2020-10-23T16:41:34.010900Z

I built a version locally, using Maven, based on a t.d.a add-lib branch a while back I think. Whatever was the equivalent of 0.8.667 it seems.

seancorfield 2020-10-23T16:45:46.011700Z

I built it on April 6th, so it's probably the head of the add-lib branch, which was 0.8.667 plus the calc-basis stuff, looking at the commit logs. @dominicm I guess keeping your own version around for this isn't going to work for your use case?

dominicm 2020-10-23T16:46:46.012200Z

@seancorfield it would yeah, I had assumed that stuff was completely broken by the internal changes. I'll give it a go, thanks!

seancorfield 2020-10-23T16:50:02.014400Z

@dominicm an FYI on usability there: both clj-new and depstar ended up allowing symbols or strings in most argument slots because of quoting so :template foo works because it is silently converting the symbol to a string behind the scenes. But of course you can't use symbols in all cases (and particularly yours).

seancorfield 2020-10-23T16:50:52.015200Z

-rw-r--r--  1 sean  admin     58110 Apr  6  2020 tools.deps.alpha-0.8.667-add-lib.jar
In case you want a sanity check on the size of the JAR after you build it. Then I just use :local/root to depend on the JAR.

dominicm 2020-10-23T16:50:59.015600Z

@seancorfield heh, that feels like a dangerous path with spaces and backslashes, etc.

dominicm 2020-10-23T16:51:23.016400Z

I wonder if a directory named "4" would work, for example

seancorfield 2020-10-23T16:51:41.017300Z

Yup, it only works for "strings" that could be legal Clojure symbols... No, because that would be read as a number, not a symbol.

πŸ‘ 1
dominicm 2020-10-23T16:51:42.017500Z

Even my example is dangerous because it doesn't escape backslashes.

dominicm 2020-10-23T16:52:05.018200Z

Seems like you wouldn't want to script anything on that basis then.

seancorfield 2020-10-23T16:52:32.018800Z

I suspect you could use :4 -- I think both clj-new and depstar would work with keywords too since they just call name on the argument... Oops, no, that doesn't work. Just symbols and strings then.

dominicm 2020-10-23T16:52:38.018900Z

I'll probably have to deploy it somewhere, but that's fine :)

seancorfield 2020-10-23T16:56:27.019700Z

(because I just call str on it -- I thought I was being fancier than that)

dominicm 2020-10-23T16:59:38.020100Z

Str on a number works I guess?

dominicm 2020-10-23T17:04:16.021900Z

Anyway. Not a problem/solution situation really. Just an observation that this decision had this property. I'm sure eventually we'll know when to apply each decision (or find a new decision) to get desired properties.

seancorfield 2020-10-23T17:13:22.023600Z

Yeah, that's why I crossed that out. I tried :4 as one of the args and got the equivalent of ":4" πŸ™‚ Much depends on whether you want a plain string or, ultimately, a qualified symbol or relative path or...

souenzzo 2020-10-23T18:36:30.024100Z

I can't find how to do clj -m app.main in "modern #tools-deps

Derek Passen 2020-10-23T18:38:59.024500Z

clj -M -m app.main, I believe

borkdude 2020-10-23T18:44:52.024700Z

correct

alexmiller 2020-10-23T19:02:37.029100Z

just wait till we get to post-modern clj

πŸ˜‚ 1
alexmiller 2020-10-23T19:03:21.029900Z

I just pushed an add-lib3 branch that's up to date with master

souenzzo 2020-10-23T19:03:56.031100Z

can I stay using clj -m app.main on my deploy/scripts?

alexmiller 2020-10-23T19:04:49.031400Z

note that add-lib is now add-libs and there are some other additional apis (not final) in there too - find-revs and find-lib

borkdude 2020-10-23T19:06:22.032200Z

in post-modern clj there is no one big story of arguments, but lots of different forks of clj where everyone does their own thing

borkdude 2020-10-23T19:08:04.033100Z

no one believes that hammock time eventually leads to the ultimate truth anymore. instead writing clojure programs becomes an expression of doubt

πŸ˜‚ 1
borkdude 2020-10-23T19:08:19.033300Z

:P

alexmiller 2020-10-23T19:08:26.033500Z

also, at some point in the past I made it degrade gracefully if it doesn't have the compiled s3 class stuff so it's a little easier to hack onto a classpath like it was originally

dominicm 2020-10-23T19:08:40.033800Z

I haven't released stable software since spec-ulation

borkdude 2020-10-23T19:09:08.034300Z

so hasn't core maybe? I should check

alexmiller 2020-10-23T19:09:16.034400Z

for now, yes (eventually that will stop working but not soon)

πŸ‘ 1
alexmiller 2020-10-23T19:09:27.034700Z

1.10.1 :)

βœ”οΈ 1
dominicm 2020-10-23T19:10:26.035500Z

Great, I guess I know what I'm doing tomorrow then!

2020-10-23T19:10:43.036Z

When i start an nrepl server through cider and eval datomic.client.api/client it complains about missing hmc auth. Indeed, if i check my cider-classpath that dep is missing. The issue is the same as discussed here: https://clojurians-log.clojureverse.org/datomic/2020-07-22, which the solution being to update clojure. I updated via linuxbrew and now my version of clojure tools is 1.10.1.727. The issue remains. My only idea is that if i ask cider to desribe the connection it says clojure is on 1.10.1 not 1.10.1.727 i'm not sure if its truncating or if it somehow connecting to an old version

dominicm 2020-10-23T19:11:31.036100Z

My goal is that beginners can do (require 'beginner) or something, and it'll go ahead and fetch tools like spyscope and dot-clojure2 for them, and load them up. Perfect compromise between beginners and advanced users (who will set that stuff up for themselves eventually)

alexmiller 2020-10-23T19:11:55.036600Z

727 is the version of the clojure tools. the actual clojure version really is 1.10.1

πŸ‘ 1
alexmiller 2020-10-23T19:12:31.037200Z

(unobviously, any version of the clojure tools can use any version of clojure - the clojure tools part really just tells you what it was built with and what version of clojure you get by default if you don't specify one)

dominicm 2020-10-23T19:13:30.037500Z

❯ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.0.0"}}}'                                   
Downloading: org/clojure/clojure/1.0.0/clojure-1.0.0.pom from central
Downloading: org/clojure/clojure/1.0.0/clojure-1.0.0.jar from central
Clojure 1.0.0-
user=> *clojure-version*
{:major 1, :minor 0, :incremental 0, :qualifier ""}
user=> 

dpsutton 2020-10-23T19:16:26.038700Z

possible the erroneous classpath computed by an older tools deps is cached? just delete the cache?

borkdude 2020-10-23T19:16:42.039200Z

or use -Sforce

2020-10-23T19:18:30.041400Z

I deleted .cpcache (which i assume is the only cache) and it didn't work. I tried -Sforce, which starts a repl but then I can't connect to it with cider. I just get a "connection failed". I'm going to try restarting my computer and assume this is a cider thing. Thanks for the suggestions.

dpsutton 2020-10-23T19:19:06.041900Z

its not CIDER. and restarting the computer won't clear the cache that is suspected to be at issue (if we are correct)

alexmiller 2020-10-23T19:21:37.042400Z

.cpcache is the classpath cache so sounds like you've done that already

dpsutton 2020-10-23T19:21:55.042700Z

oh wow. i totally glossed right over that message. sorry

alexmiller 2020-10-23T19:22:41.043200Z

oh that hmac auth thing was actually a tools deps bug and should be fixed in latest

dominicm 2020-10-23T19:23:03.043300Z

I wonder if there's 2 copies of clojure in $PATH or something...

alexmiller 2020-10-23T19:23:20.043600Z

yeah, can you repro outside cider?

alexmiller 2020-10-23T19:23:46.044500Z

if not, I'd guess you're somehow seeing a different version of clojure, or something is explicitly using an older version of tools.deps.alpha

dominicm 2020-10-23T19:24:20.045100Z

cider literally just runs clojure -Sdeps '{nrepl/nrepl … cider/cider-nrepl …}' -m nrepl.cmdline …

2020-10-23T19:25:09.045900Z

cider does just run clojure -Sdeps, but ill try using it directly just in case.

dominicm 2020-10-23T19:26:18.046Z

cider's jack-in isn't magic, it's just saving you knowing which dep & which main to start.

dpsutton 2020-10-23T19:27:17.046400Z

(and now prints that and optionally the cljs startup to remove any semblance of magic)

2020-10-23T19:40:30.049Z

The issue was corrected by having cider look at a version of clojure tools that had the bug fix. I had two versions of clojure installed (no useful reason for that). So i uninstalled both and reinstalled using linux brew. As dominicm points out, you can look at what version of clojure cider is using in the message. It was different from what i got at the command line. So after verifying one version worked but not another, it was fairly obvious. When i run clj /clojure from the command line it tells me the version of clojure, but in this case it seems it was the version of tools deps that was different between the two. e.g /usr/local/bin/clojure starts a repl with "clojure 1.10.1" and the other version in /home/drewverlee/.linuxbrew/bin/clj says "clojure 1.10.1" so part of me assumed they were a symlink/alias.

Eamonn Sullivan 2020-10-23T19:59:42.049300Z

So, you asked how I got on: I decided to try one of the pre-built images. The test/pull-request checks are working, but not the deploy. I get a TransferFailedException. I'm literally only hours old as a CircleCI user and I'm probably doing something basically wrong.

alexmiller 2020-10-23T20:02:19.049600Z

cool

seancorfield 2020-10-23T21:29:35.049900Z

@alexmiller Thanks for the add-lib3 branch -- very nice that it works from source again, albeit without S3 support! Just updated my .clojure file for that.