Fork me on GitHub
Jeff Friesen17:09:34

I have a beginner-level question about Calva and profiles. I followed the lein tutorial where it creates 2 profiles. Here are the 2 profiles:

:profiles {:uberjar {:aot :all
:jvm-opts [“”]}
:dev {:dependencies [[ring/ring-devel “1.4.0"]]}})
I vaguely understand what profiles are for but I don’t know how they relate to the REPL. Calva asks which profile to launch from (for example, dev or uberjar) a) If I don’t select either it still connects. The REPL starts up and evaluates code. What’s it using? b) More importantly for my understanding, what are the practical differences between using the two and why would I pick one over the other?  c) What happens when I pick both?


It's a good question. We should probably try to answer it well at The profiles do not relate to Calva all that much if you use jack-in, but if you are not using jack-in it gets another story. Regardles. Say you are using jack-in. Then calva injects what it needs, and the profiles what you need for your development. So if you need some particular library on the classpath for instance. The REPL will not find it if it is not part of the ”global” classpath or the one set up by any profiles. Choosing dev is most often the right thing to do. But for some setups you might want to load some other profile as well.

Jeff Friesen17:09:13

Thank you @pez. So what happens if you don’t choose a profile or if you choose 2 profiles? As a beginner (or at least a recurring beginner) I get frozen at that first step of getting up and running. What if I pick the wrong one? Or none? Or both? If it doesn’t matter except for special situations, I wonder if there should be a “default” pre-selected or something along those lines


Since people can use whatever profile names, Calva can't really guess about defaults w/o risking to mess things up. Maybe we can add something like “(if you're uncertain, dev is probably the right choice)” to the prompt.

Jeff Friesen18:09:57

good point regarding profile names are not consistent. What does Calva do if you don’t pick a profile? Could that be the suggested default?

Jeff Friesen18:09:20

I know it’s a weekend. None of this is urgent. thank you


Oh, Calva is my weekend job, don't worry. As for what Calva does with no profile picked, it will not really care. The profile is about what the project needs. And most often I would think that if a dev profile exists, that is probably what the project needs in development. But a particular project might have profiles that are shared between development and, say testing, and that will be needed in both cases.


In short, as far as I understand things, Calva can't provide defaults here. It does allow the project to provide defaults, which I have added to various project templates, but when those are not provided, someone will need provide them. Someone with project knowledge.

Jeff Friesen19:09:46

I see. Makes sense. So I wonder what’s a good experience for someone just getting started. Just a note in the getting started documentation? Or a note in the option list? Or something else?


Perhaps both, but at least in the docs, probably here:


It's hard to know where people look for information. I suggested adding something to the prompt since you informed me that you felt a bit stopped in the tracks at that prompt. But we should consider adding it a bit everywhere. The docs have this to say... aaaand, @brandon.ringe beat me to it. 😃

😄 3

To add to Peter's notes about choosing a profile, if you choose none, Calva only injects its own dependencies, as it would if you chose a profile, and nothing else is done further.


A think we could consider is a more guided jack-in. One you can use if you are new to Clojure. Not sure how it would materialize, the idea just popped into my head... Anyway, there is a case for guiding Clojure beginners differently than experienced clojurians....


If we go this path we could even provide help with setting up thee project and stuff.

Jeff Friesen19:09:11

Right. I keep jumping back into Clojure about once a year and each time it feels like so much friction. I know how to write the code but getting productive again is painful. Calva is my best best, especially since I use vscode when I’m not writing Clojure. So that need for guidance for beginners I feel acutely

Jeff Friesen19:09:25

But of course, you need to serve experienced folks too


Feedback from the getting started perspective is very valuable, so feel free to keep mentioning ideas you have and make issues if needed.

👍 3

Yes, we do try to make Calva extra nice for beginners while still being a good choice for when you have reached past that stage. It's a bit tricky to balance it, which is why I think some kind of special thing for the beginner might make sense. Still have no idea what it would look like, but anyway. 😃

Jeff Friesen20:09:54

Setting up the project would be amazing but I know it may be a lot of overhead for maintainers. But what I think is missing from clojure and clojurescript for absolute is immediate gratification and success of getting something done right away. I’ve had the thought so several times, “I know what a repl is, but I don’t know (or care at this moment) what an nrepl is”. Or piggyback or cider or any of the other steps that are essentially incidental complexity. I think removing those barriers, which you both are making a lot of progress on, is so valuable. Every experience clojure dev talks about how life changing repl-driven dev is, but it takes an experienced dev to walk you through it several times to set up everything


There are many moving parts to this problem too, but we can improve it by chipping away at it over time

Jeff Friesen20:09:09

Thanks to both of you. Here’s another question: Do I have to disconnect from the repl before shutting down vscode or leaving the project? I don’t want to leave zombie Java processes running around


So, disconnecting wouldn't help anyway. But if Calva started the project (aka Jack-in) then it will close the process when the VS Code window is closed (most often VS Code does this, actually, but on Windows this fails a bit so Calva has code for dealing with it).

Jeff Friesen20:09:56

That’s great. thanks