Fork me on GitHub
#tools-deps
<
2020-10-23
>
Drew Verlee00:10:38

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

Alex Miller (Clojure team)00:10:49

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

👍 3
dominicm07:10:51

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.

dominicm07:10:05

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.

dominicm10:10:31

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

Alex Miller (Clojure team)11:10:23

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

Alex Miller (Clojure team)11:10:27

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

Alex Miller (Clojure team)11:10:05

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

dominicm11:10:22

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

seancorfield16:10:34

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.

seancorfield16:10:46

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?

dominicm16:10:46

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

seancorfield16:10:52

-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.

dominicm16:10:38

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

Alex Miller (Clojure team)19:10:21

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

Alex Miller (Clojure team)19:10:49

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

Alex Miller (Clojure team)19:10:26

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

dominicm19:10:26

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

dominicm19:10:31

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)

seancorfield21:10:35

@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.

Eamonn Sullivan08:10:03

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.

borkdude08:10:41

@eamonn.sullivan Almost all of my projects do

Eamonn Sullivan08:10:06

Ah, perfect. Thank you!

practicalli-john09:10:01

@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)

👍 3
practicalli-john09:10:44

@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.

Eamonn Sullivan19:10:42

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.

Eamonn Sullivan13:10:25

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-john15:10:43

Thanks for sharing

Alex Miller (Clojure team)11:10:15

Yeah that doesn’t look right

dominicm11:10:11

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

Alex Miller (Clojure team)12:10:28

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

dominicm14:10:41

@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

dominicm14:10:12

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.

Alex Miller (Clojure team)14:10:43

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

Alex Miller (Clojure team)14:10:09

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

dominicm14:10:38

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

arohner11:10:43

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

dominicm14:10:52

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)

Alex Miller (Clojure team)14:10:18

and it's awkward because? quoting?

dominicm14:10:06

@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.

seancorfield16:10:02

@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).

dominicm16:10:59

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

dominicm16:10:23

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

seancorfield16:10:41

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

👍 3
dominicm16:10:42

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

dominicm16:10:05

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

seancorfield16:10:32

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.

seancorfield16:10:27

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

dominicm16:10:38

Str on a number works I guess?

dominicm17:10:16

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.

seancorfield17:10:22

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...

souenzzo18:10:30

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

Derek18:10:59

clj -M -m app.main, I believe

Alex Miller (Clojure team)19:10:37

just wait till we get to post-modern clj

😂 3
souenzzo19:10:56

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

Alex Miller (Clojure team)19:10:16

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

👍 3
borkdude19:10:22

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

borkdude19:10:04

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

😂 3
dominicm19:10:40

I haven't released stable software since spec-ulation

borkdude19:10:08

so hasn't core maybe? I should check

Drew Verlee19:10:43

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

Alex Miller (Clojure team)19:10:55

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

👍 3
Alex Miller (Clojure team)19:10:31

(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)

dominicm19:10:30

❯ 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=> 

dpsutton19:10:26

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

borkdude19:10:42

or use -Sforce

Drew Verlee19:10:30

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.

dpsutton19:10:06

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

Alex Miller (Clojure team)19:10:37

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

dpsutton19:10:55

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

Alex Miller (Clojure team)19:10:41

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

dominicm19:10:03

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

Alex Miller (Clojure team)19:10:20

yeah, can you repro outside cider?

Alex Miller (Clojure team)19:10:46

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

dominicm19:10:20

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

Drew Verlee19:10:09

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

dominicm19:10:18

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

dpsutton19:10:17

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

Drew Verlee19:10:30

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.