Fork me on GitHub
#tools-deps
<
2022-02-01
>
Patrix03:02:23

hey all, I’m looking for some pointers here.. Any help appreciated: I’m looking at https://kit-clj.github.io/ , and want to use the 2 commands on this page:

clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.381"}' :as new
    clojure -Tnew create :template io.github.kit-clj :name yourname/guestbook
This is what I get with the first one:
clojure -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.381"}' :as new
Error building classpath. Unknown tool: tools
 clojure --version
Clojure CLI version 1.10.3.1069
I’m definitely on the latest… not sure what I did wrong. I swear I ran these 2 commands a few weeks ago when kit was first announced, deleted the folder, trying again now.. I’m on macos 12.3 (beta), but behavior is the same on 12.2 (not beta). clojure is installed from MacPorts.

Alex Miller (Clojure team)03:02:36

We don't release anything on macports so that's probably not a good install

Alex Miller (Clojure team)03:02:38

The brew install will copy in the tools definition to -/.clojure/tools/tools.edn

seancorfield05:02:42

FWIW someone showed the guix Clojure CLI installer and that's also missing the tools stuff. I think these installers were based on pre-tools CLI and they are do custom installs of specific files and they seem to update the JAR version but don't revisit the actual files in more recent versions. The GitHub Actions installer was like that until the author reverted to using the official Linux installer to set things up. That's why these unofficial installers are really problematic 😞 @patrix

Alex Miller (Clojure team)14:02:56

I would like to make the Linux installer work seamlessly on Mac too (I don't think it does right now)

Patrix05:02:12

that would all make sense, then.. I don’t have brew on my Macs because it annoys me 😉 I’ve managed to find the tools.edn and copy it to my ~/.clojure/tools, and it does appear to work now. And I’ve checked in the macports install, no tools.edn there… 😞 thanks for all the info! I probably should submit a bug to macports or something…

phronmophobic05:02:22

I'm also on macports 😕 Here's the process I ended up using in case it's helpful: 1. Find url from https://github.com/clojure/homebrew-tools (eg. https://github.com/clojure/homebrew-tools/blob/master/Formula/clojure.rb) 2.

wget ""
tar xvf clojure-tools-1.10.3.1069.tar.gz 
cd clojure-tools
sudo HOMEBREW_RUBY_PATH=`which ruby` ./install.sh /usr/local

Patrix05:02:07

oh, I tested it just now and seems to work: I extracted the tools.dep from that file and put it in /opt/local/lib/clojure

Patrix05:02:21

it probably won’t persist the next time macports updates clojure, we’ll see..

phronmophobic05:02:27

yea, the method I used puts clojure outside of macport's management

phronmophobic06:02:04

I'd rather macports be completely in charge of the dependency or do it myself rather than trying to share responsibility for the install.

seancorfield06:02:57

FWIW, I ended up using brew on macOS (despite its quirks) and then linuxbrew on Windows/WSL2 so I at least have the official Clojure tap/install going on. I don't use brew for anything else.

seancorfield06:02:56

That way I can easily upgrade stable releases any time and I can also easily install any specific version (I have dozens of versions installed on both macOS and Ubuntu so I can run regression tests).

phronmophobic06:02:04

I would love to use an officially supported install method, but as far as I can tell, homebrew and macports are incompatible

seancorfield06:02:08

As problematic as Homebrew can be, I've had far worse problems with MacPorts over the years, TBH. Hence why I stick to Homebrew just for Clojure.

1
seancorfield06:02:31

(and I don't use MacPorts for anything at all)

Patrix06:02:25

I guess mileage does vary..

phronmophobic06:02:27

I use macports for lots of things and it's non-trivial to switch. At some point, I looked into whether it would be worth switching and found that homebrew wouldn't work for me 🤷

Patrix06:02:13

I was in the middle of fixing a production issue and needed to install a piece of software - everything else related, I had installed with brew. brew install xxxxxx ended up updating half my packages because of one minor python update, wasting valuable time.. that very same day I switched to macports

Patrix06:02:32

anyway for now having tools.edn in /opt/local/lib/clojure and in ~/.clojure/tools/ will work

seancorfield06:02:12

Yeah, I def. wouldn't install stuff generally with brew -- their belief that everything should always depend on the very latest version of every package is just insanity. IMO.

seancorfield06:02:56

It's why Alex switched to a Clojure-specific tap and removed the dependency on the JDK (because brew would "helpfully" install whatever it thought was the latest JDK and override your chosen installation).

seancorfield06:02:49

Aside from apt, I don't rely on package managers for anything normally. The maintainers often have very peculiar ideas about "how the world should be"...

Patrix06:02:26

ah makes sense why clojure is using a tap in brew, indeed

Patrix06:02:12

yeah more and more I just want to run things in Docker, as much as I dislike it, just to avoid packagers assuming a million things about my system. But that brings its own pains

Patrix06:02:17

especially on a Mac haha

seancorfield07:02:26

I run Docker (on both my Mac and on Windows/WSL2) to provide Percona, Elastic Search (two instances), and Redis -- but I always run Clojure on the bare metal.

seancorfield07:02:15

But I only develop in Clojure so I have no need of anything but a JDK installed (well, I have several versions, but JAVA_HOME controls those).

Patrix07:02:51

Makes sense lol

Alex Miller (Clojure team)14:02:58

Presumably someone did some work on macports for Clojure to be available at all there and it could be updated to work

Patrix00:02:15

Yes I suppose so, soon as I convince myself to create a Trac account on http://macports.org I’ll submit a bug report..

Ben Sless08:02:14

Nix / guix support?

phronmophobic18:02:08

I'm embarrassed to say that I hadn't considered trying to submit a patch to the clojure Port for macports. It's been updated fairly recently. Just manually comparing the https://github.com/macports/macports-ports/blob/master/lang/clojure/Portfile and https://github.com/clojure/brew-install/blob/1.10.3/src/main/resources/clojure/install/install.sh, it seems like the only thing missing is copying tools.edn. I'll https://guide.macports.org/#project.github and see what happens.

1
phronmophobic20:02:59

better late than never: https://github.com/macports/macports-ports/pull/14016 hopefully, I followed the PR process correctly 🤞

🙌 1
phronmophobic21:02:53

looks like my patch is now included 🎉

$ sudo port install clojure
--->  Fetching archive for clojure
--->  Attempting to fetch clojure-1.10.3.1075_1.darwin_21.noarch.tbz2 from 
--->  Attempting to fetch clojure-1.10.3.1075_1.darwin_21.noarch.tbz2.rmd160 from 
--->  Installing clojure @1.10.3.1075_1
--->  Deactivating clojure @1.10.3.1075_0
--->  Cleaning clojure
--->  Activating clojure @1.10.3.1075_1
--->  Cleaning clojure
--->  Scanning binaries for linking errors
--->  No broken files found.
--->  No broken ports found.
--->  Some of the ports you installed have notes:
  clojure has the following notes:
    Install the rlwrap port and invoke `clj` for more a more ergonomic REPL.
$ ls /opt/local/lib/clojure/
deps.edn          example-deps.edn  libexec/          tools.edn         
$ rm ~/.clojure/tools/*
$ clojure -Sforce -Ttools install com.github.seancorfield/clj-new '{:git/tag "v1.2.381"}' :as new
Installed new
$ ls ~/.clojure/tools/
new.edn    tools.edn  

1
vlaaad13:02:32

Amazing that this git dep works:

io.gitlab.arbetsformedlingen/taxonomy-dev/backend/jobtech-taxonomy-common {:git/tag "v1.12" :git/sha "e5556b7"}

vlaaad13:02:18

can I rely on that, or should I specify :git/url and use saner lib name?

vlaaad13:02:51

@cfleming also would be nice if Cursive didn’t complain about symbols with multiple slashes…

cfleming20:02:09

Is that even a thing? I didn’t think that was legal.

cfleming21:02:07

Actually, I just read the rest of the conversation, never mind…

borkdude14:02:22

symbols with multiple slashes are invalid. https://clojure.org/reference/reader

Alex Miller (Clojure team)14:02:36

I would not rely on that and use a git url instead

vlaaad14:02:31

I think there was some law of someone that states that with time all observable behaviors of a dependency/system will be relied upon

cfleming21:02:40

That’s the law of anyone developing tooling.

borkdude14:02:13

hyrum

✔️ 2
vlaaad17:02:47

Wouldn't it be nice to have svg "shields"/"badges" for readmes that show latest git dep versions? Shame that GitHub doesn't allow selecting text in these svgs...

1
hlship20:02:12

Q: Is there a reason why the tools can't identify the source/line/column of errors, e.g.:

~/workspaces/walmart/push-services/push-load-test-service > clj -X:dev:test
Error building classpath. Coord of unknown type: {}

hlship20:02:45

It would helpful if it said "In file deps.edn, line 18" or something, especially if it's from a deps.edn from a dependency.

Alex Miller (Clojure team)20:02:28

the point where that is detected is many steps away from when the deps is read (and may not even be from a file), and has already gone through multiple steps of merging/manipulation

Alex Miller (Clojure team)20:02:12

not impossible, but it's probably a fair amount of work to get to that point

Alex Miller (Clojure team)20:02:45

would probably be easier to catch with more validation during the read

borkdude22:02:20

clj-kondo does offer linting for deps.edn - feel free to suggest more checks in #clj-kondo @hlship

borkdude22:02:44

it already lints that example:

Alex Miller (Clojure team)23:02:16

depending on where that's coming from above, you wouldn't see it outside your own deps.edn though