joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
2019-04-04T19:08:31.003100Z

One thing that's awesome about Go is that you can use the go tool to import libs directly from say github. Jocker is awesome and I really want to be able to use it for all of my scripting needs (especially ops / orchestration), so I'm wondering if there's something convenient like the go imports for clojure. The thing that's blocking us is having dependency / package management... so I was thinking if there would be a suitable "require" that would download a file if (cacheing if necessary) and then using that file so that the script can leverage packages that are provided externally but still remain standalone. Has anyone gone down this path?

đź‘Ť 1
seancorfield 2019-04-04T20:26:06.004300Z

@charlesg3 With add-lib (in a branch of tools.deps.alpha) you can add Git deps dynamically at run time...

seancorfield 2019-04-04T20:27:25.004800Z

Here's an example that lets you add the master of any Git project to your classpath https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L103-L116

2019-04-04T20:44:41.005200Z

How do I get access to tools.deps.alpha in joker?

borkdude 2019-04-04T20:53:07.005700Z

@charlesg3 so you want a dependency system for joker scripts?

2019-04-04T20:55:42.006400Z

Basically yeah, but since it's for scripts I'm just trying to think through what's the most lightweight way of resolving external dependencies (which may reside on the web)

borkdude 2019-04-04T20:57:51.006900Z

you can fetch those using joker’s http client?

borkdude 2019-04-04T20:58:13.007300Z

since joker has eval, it should be possible to fetch an external script and execute it

2019-04-04T20:58:23.007600Z

Yep... I can build it all up using the existing utilities

2019-04-04T20:58:33.007900Z

I was just curious if anyone had gone down the path of something more managed

2019-04-04T20:59:11.008900Z

Furthermore, if I start writing the code to do it using existing utilities I have a chicken-and-egg problem. Of course I can simply download the dependency manager first and then use it to get any other dependencies, but if it were included somehow I would avoid that

borkdude 2019-04-04T20:59:26.009300Z

you can probably re-use clojars for this? and fetch the deps using tools.deps or something?

2019-04-04T20:59:55.009800Z

I guess I could, but I'm not looking to download jars...I'm looking to require joker files

2019-04-04T21:00:12.010400Z

That seems a little heavyweight TBH

borkdude 2019-04-04T21:00:30.010800Z

you can also use git deps with tools.deps, that way you can avoid clojars

borkdude 2019-04-04T21:00:49.011100Z

and git deps can probably declare deps on other git deps

2019-04-04T21:01:14.011400Z

Right, but how do I get tools.deps in joker?

borkdude 2019-04-04T21:01:28.011900Z

why would you need to run the resolving/downloading of deps inside joker?

2019-04-04T21:02:08.012800Z

Because I'm just using joker as a scripting language for ops management. Perhaps on a separate machine, simply to avoid jvm memory / startup reqs

borkdude 2019-04-04T21:02:23.013500Z

once tools.deps has downloaded the deps needed, it caches the necessary stuff, so it’s very fast the next time

2019-04-04T21:02:25.013600Z

(hence why I'm asking in this channel... I can certainly manage deps using regular clojure np)

borkdude 2019-04-04T21:03:28.015Z

or maybe you can rip out a part of tools.deps and re-implement that in joker. something I certainly wouldn’t do because I see it as wasted time 🙂

seancorfield 2019-04-04T21:03:49.015600Z

Ah, I misunderstood what you were trying to do. All of what I'm suggesting assumes the JVM, sorry. I can't imagine living in a world where I don't have the JVM on every system 🙂

borkdude 2019-04-04T21:04:54.017Z

but I guess you can piggie back on some other dependency system that also supports git deps. npm maybe?

2019-04-04T21:06:08.018400Z

No worries... I can figure something out. It seems pretty easy to simply implement a fetch if I don't have this dep functionality (e.g. caching) in some lib that I download. I was just curious if anyone had done such a thing with joker alone so I could leverage that or gain some insights.

2019-04-04T21:07:06.019400Z

The main trade-off is that I have to bootstrap such a system, so having that support embedded into joker would avoid that bootstrapping step. So I wanted to check to make sure that I wasn't missing something that even easier than what I'm thinking of

Candid 2019-04-06T00:50:13.028900Z

I've been thinking about deps management for Joker, but it's a hard problem and I have not had the bandwidth lately to take this on. I want deps to be specified in the code itself, rather than in a separate file processed by a separate tool. Something like (require '<namespace> :from <url>), but obviously there is a lot to think about here.

2019-04-12T19:27:47.000200Z

Yeah -- I agree something like this is a nice direction to go and the go tool does a pretty good job of this.