Fork me on GitHub
#babashka
<
2022-12-03
>
Kari Marttila09:12:16

I'm planning to use babashka in one project. There is a good explanation of the initial setup for deps.edn based development in this documentation: https://book.babashka.org/_/deps_clj.html I was wondering if the example can be found in some git repo as well?

Kari Marttila09:12:16

Well, actually no need. The documentation provides everything I need.

Kari Marttila09:12:30

Good documentation, by the way. šŸ™‚

Kari Marttila09:12:15

Hm. Except I'm a bit confused. If I want to start babashka so that I can use its nrepl in development, and also some dependencies, like clj-http-lite, do I create a bb.edn file for my project or a deps.edn file?

borkdude09:12:55

a bb.edn file is for deps for babashka

borkdude09:12:07

and if you then start bb nrepl-server it works

borkdude09:12:31

correct. where did you read this? we might have to remove that

borkdude09:12:49

it's built into babashka

borkdude09:12:58

and used if you put deps in bb.edn

Kari Marttila09:12:13

Probably I just misunderstood it.

borkdude09:12:46

ah I don't know how you ended up there... it's a very old version of the book :) These are the docs: https://book.babashka.org

borkdude09:12:53

I can see if I can remove those old references...

Kari Marttila09:12:36

My brother asked me to create an app for fetching some electricity information. I thought I do it using babashka, and write a blog post about this small project to promote this excellent tool. šŸ™‚

borkdude09:12:04

Should be a good use case :) You can also use babashka.curl as the built-in library. Also java.net.http is supported

Kari Marttila09:12:23

Ah. Ok. šŸ™‚

Kari Marttila09:12:34

This will be fun! šŸ™‚

Kari Marttila10:12:08

And I think I can use VSCode + Calva with babashka when developing the solution?

borkdude10:12:43

you can use babashka jack-in even

Kari Marttila10:12:45

I remember that my last Babashka blog post even made it to Hacker News. Let's see if I can make it to Hacker News again. šŸ™‚

Kari Marttila10:12:23

Actually you told me to see it in HN. šŸ™‚ I was watching it with great interest. It climbed to position 11 but never made it to number one. šŸ™‚

borkdude10:12:44

I tried to remove that old document but now the whole docs aren't reachable... hopefully it will be fixed when the github cache is evicted...

Kari Marttila10:12:02

I really have to read the excellent https://book.babashka.org/ book again before I publish the new blog post. To see that I really have understood everything properly.

borkdude10:12:15

ok, the book is back. I want to move to mkdocs-material at one point, Calva also has this, it looks nicer :)

Kari Marttila10:12:24

Unbelievable. I'm going to be unemployed any day now.

Kari Marttila10:12:13

I installed Github copilot a few days ago, and I was amazed how good suggestions it provides. But this is the first time I try it with Clojure. It practically wrote the function for me.

Kari Marttila10:12:35

I'm so happy I have paid my mortgage and I managed to gather a nice stock portfolio. We programmers are all going to be unemployed in the near future. šŸ™‚

borkdude10:12:48

hehe šŸ˜…

Kari Marttila11:12:07

Sorry for the delay with the blog post. šŸ™‚ I needed to visit my old parents and provide some help there. But I wrote the blog post now: https://www.karimarttila.fi/clojure/2022/12/04/using-babashka-to-get-electricity-prices.html @U04V15CAJ: If you want, you can read the blog post, and if there is some obvious misunderstanding or something like that, ping me here. šŸ™‚

borkdude11:12:06

@U76D9RZRR Reading it now. First of all, I think it's awesome you're writing this, it benefits other people to have resources like this. First issue:

{:paths ["src" "test"]
 :deps  {nrepl/nrepl {:mvn/version "1.0.0"}
         cider/cider-nrepl {:mvn/version,"0.28.6"}}}
You don't need the nrepl dependencies, babashka has nrepl support built in and won't do anything with these deps

borkdude11:12:05

Minor thing:

(Integer/parseInt hour)
You can now write this as (parse-long hour) - parse-long was added in 1.11 and is also available in bb (given that you have a recent one of course)

borkdude11:12:34

That's all. Great post :)

Kari Marttila11:12:49

Ah! I update the solution and blog post regarding these issues! Thanks!

borkdude11:12:11

Maybe you could show how you ran this script in cron - it might not be obvious to people how to run the script when not in a REPL

Kari Marttila11:12:24

Good, point. I do it!

borkdude11:12:23

And finally, you could post it on social networks and #news-and-articles of course :)

Kari Marttila11:12:08

Yep. I'll do it!

borkdude12:12:44

Thanks again :)

Kari Marttila14:12:36

Heh. I promoted my new Blog post also in the Koodiklinikka slack / Clojure channel (Koodiklinikka slack is the community for Finnish programmers). One reader reacted immediately with this text (translation by Google, and I fix one lost-in-translation meaning): > Very cool. Now I got a really strong itch that this might be the gateway to the Clojure world I've been missing. > > I had thought that I would make the next small shell utilities for myself with Clojure instead of Python, but I didn't really figure out where to start.

Kari Marttila14:12:45

It seems you got one more Babashka user. šŸ™‚

Kari Marttila14:12:54

You can use that in advertizing: "Babashka is the gateway to the Clojure world!" šŸ™‚

Kari Marttila14:12:59

I promised to help this new user in Koodiklinikka if he has any issues with Clojure or Babashka. Nice to see that Clojure and Babashka are getting more and more ground among programmers.

šŸ‘ 1