babashka-sci-dev

borkdude 2022-03-19T09:18:28.191599Z

@wilkerlucio I'll take the discussion here about meander. ๐Ÿงต

borkdude 2022-03-19T09:18:56.742569Z

I've ran the tests:

Ran 155 tests containing 316 assertions.
2 failures, 11 errors.
{:test 155, :pass 303, :fail 2, :error 11, :type :summary}
So there are still a few glitches to iron out, hopefully we can make them pass all.

borkdude 2022-03-19T13:39:57.190849Z

There seems to be an issue with gather

user=> (babashka.main/main "-cp" "src" "-e" "(require '[meander.epsilon :as r] :reload '[meander.match.epsilon] :reload) (r/match [1 2 3 4 5 6] (r/gather (r/pred any? !xs) ...) !xs)")
:count-pattern ...
:meander/match :syntax-phase
false :nat-int
true :symbol ...
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  non exhaustive pattern match
user=> (babashka.main/main "-cp" "src" "-e" "(require '[meander.epsilon :as r] :reload '[meander.match.epsilon] :reload) (r/match [1 2 3 4 5 6] (r/pred any? !xs) !xs)")
[[1 2 3 4 5 6]]
0

wilkerlucio 2022-03-19T09:18:31.223019Z

@wilkerlucio has joined the channel

cap10morgan 2022-03-19T15:36:27.770279Z

@borkdude OK think I addressed everything in the two PRs. Let me know if you see anything else.

cap10morgan 2022-03-19T15:37:32.450319Z

oops, looks like I still have an issue to address with :local/root pods

cap10morgan 2022-03-19T15:38:31.531749Z

or... perhaps not. anyway, testing that out now. I'll keep you posted. ๐Ÿ™‚

borkdude 2022-03-19T15:39:47.002349Z

looks pretty good so far!

borkdude 2022-03-19T15:46:22.018159Z

apart from the minor remarks, maybe we'll have to do a final bike-shed over the naming.

:local/root
is derived from deps.edn, and makes sense since it's the root directory of a dependency, but pods aren't directories. I think just using :path makes more sense, like the name that the pods lib already uses for it. We could make everything namespaced:
:pod/version ... :pod/path ...
but not sure if that has any benefits since we're already dealing with pods. However, we do use that in the manifests:
:pod/name        huahaiy/datalevin
 :pod/description "Datalevin Database"
 :pod/version     "0.6.1"
 :pod/license     "EPL"

borkdude 2022-03-19T15:46:54.907279Z

but there are also other things like :os/name etc

cap10morgan 2022-03-19T15:50:30.061689Z

I think :version and :path are good. I think I'd want to leave the namespacing for something it might differentiate down the road. Like a different kind of version, for example. But like you said, it's already in a pods context here.

borkdude 2022-03-19T15:51:35.585409Z

multimethod can only dispatch on namespaced keywords right?

borkdude 2022-03-19T15:52:04.729819Z

not that that matters here (yet)

cap10morgan 2022-03-19T15:52:07.115909Z

hmm... not sure. I didn't think so

cap10morgan 2022-03-19T16:26:03.973969Z

Hmm... getting tripped up by one thing: in b.pods.impl/resolve-pod it checks if pod-spec is a qualified symbol and calls resolver/resolve on it if so. but for my local pod implementation, the pod-spec is still a qualified symbol, it just has a :path opt instead of a :version one. OK to change that check to (when version ...) ?

borkdude 2022-03-19T16:26:34.582119Z

@cap10morgan One more idea. As there is a discrepancy between local pods (which is really a dev thing maybe), we could do this: Support a :namespaces [...] option in bb.edn, as a requirement for being able to use local pods.

{:pods {foo/bar {:path "../dude" :namespaces [foo.dude foo.dude2]}}}
Then there is no need to call the local pod to inspect the namespaces.

borkdude 2022-03-19T16:27:14.331259Z

and this :namespaces option overrides whatever is in the metadata, so you can tweak it further, e.g. disable it for a certain namespace for whatever reason

cap10morgan 2022-03-19T16:28:26.755449Z

where is the discrepancy for local pods? I personally would not want to have to manually maintain a separate namespaces list in there while developing a pod. especially when the same code is already 99% capable of asking the local pod for this info. I just need to iron out this resolver issue.

borkdude 2022-03-19T16:28:45.696649Z

the discrepancy is "local describe cannot be cached"

cap10morgan 2022-03-19T16:28:57.238649Z

ah, yeah

cap10morgan 2022-03-19T16:29:13.317539Z

I mean, it could be but then cache invalidation gets tricky so I wanted to avoid ๐Ÿ™‚

borkdude 2022-03-19T16:29:37.165129Z

we could support bypassing the metadata with bb --force

borkdude 2022-03-19T16:29:49.363489Z

which is already an option to bypass the clj .cpcache file

borkdude 2022-03-19T16:29:58.216169Z

for development

borkdude 2022-03-19T16:30:08.961399Z

so it will be cached by default, unless --force is used

cap10morgan 2022-03-19T16:30:20.315579Z

that seems reasonable

cap10morgan 2022-03-19T16:31:21.195739Z

I think I still have a slight preference for just not caching it in a dev scenario. but local pods might not just be for dev, I guess. I was using one in prod before I got it into the registry. custom registries is probably the better answer there, though.

borkdude 2022-03-19T16:31:44.132209Z

agreed

borkdude 2022-03-19T16:32:03.367599Z

ok so not caching local pods then?

cap10morgan 2022-03-19T16:32:20.949249Z

that feels simplest and lowest support burden (for you, honestly) to me

borkdude 2022-03-19T16:32:21.823879Z

should we even support local pods in bb.edn? I don't even know how we arrived at that

cap10morgan 2022-03-19T16:32:36.023529Z

it would be really nice for pod development

borkdude 2022-03-19T16:32:56.302039Z

but you can use a local registry for that

cap10morgan 2022-03-19T16:33:58.452149Z

yeah, but with a lot of the same downsides (immutable versions or you need to bust the cache, etc.) versus just reloading the in-development code as it changes

borkdude 2022-03-19T16:34:51.982779Z

What about an option :path ... :cache false

borkdude 2022-03-19T16:35:31.158719Z

I could see a scenario where people in the cloud have their pods in a specific place and would still like to cache the namespaces for better warm startup times

cap10morgan 2022-03-19T16:35:40.945269Z

yeah

cap10morgan 2022-03-19T16:36:22.656689Z

maybe :cache false is the default but you can turn it back on for local pods with :path ... :cache true?

borkdude 2022-03-19T16:36:44.066209Z

the default should not be the development setting

cap10morgan 2022-03-19T16:37:31.894539Z

yeah, makes sense. the counter-argument for me is that I like defaults for non-exasperating correctness (i.e. why isn't my new namespace getting picked up?) and knobs for perf tuning

cap10morgan 2022-03-19T16:37:50.474739Z

but happy to defer to you here ๐Ÿ™‚

borkdude 2022-03-19T16:37:57.556639Z

I think the default should be the performant option

๐Ÿ‘ 1
borkdude 2022-03-19T16:38:25.581649Z

as in: people are going to try this on the cloud and we want them to succeed before they give up without even looking at that option ;)

borkdude 2022-03-19T16:38:54.596989Z

back to your original issue, what was that again?

cap10morgan 2022-03-19T16:39:52.470319Z

this? https://clojurians.slack.com/archives/C02FBBU61A9/p1647707163973969

borkdude 2022-03-19T16:42:01.782689Z

oh yes, that seems ok

borkdude 2022-03-19T16:42:21.979659Z

maybe (and qualified-symbol version)?

๐Ÿ‘ 1
borkdude 2022-03-19T16:42:47.605869Z

Thanks!

borkdude 2022-03-19T16:43:42.983079Z

I think we should also have some tests, but if the pod tests are still passing, we could just test it from the bb side

borkdude 2022-03-19T16:45:17.739409Z

So we have:

:pods {fq/sym {:path "/foo" :version "0.1.0" :cache false}}

cap10morgan 2022-03-19T16:45:33.246089Z

yes definitely

borkdude 2022-03-19T16:45:53.678919Z

Let me know if the pod side is ready for merge, then I'll do that first

cap10morgan 2022-03-19T16:45:58.355629Z

you wouldn't have version w/ path. one or the other.

cap10morgan 2022-03-19T16:46:14.939079Z

will do (still working on local pods issue)

borkdude 2022-03-19T16:46:31.242659Z

yes, agreed, they are mutually exclusive.

cap10morgan 2022-03-19T16:46:42.316779Z

ah, you were just listing the options. gotcha

borkdude 2022-03-19T16:46:54.941969Z

exactly

borkdude 2022-03-19T16:48:05.291699Z

This is going to be sweet :)

cap10morgan 2022-03-19T16:49:44.355709Z

yeah I'm excited about it ๐Ÿ™‚

cap10morgan 2022-03-19T16:49:56.595539Z

think we should allow :cache false for registry pods too?

borkdude 2022-03-19T16:50:17.724379Z

yeah, why not

๐Ÿ‘ 1
cap10morgan 2022-03-19T17:07:23.210479Z

do you think this will warrant a version bump to 0.8.0? started updating the pods README to document bb.edn pods declarations and wanted to say "As of babashka [version] you can..." I can just use a placeholder there for now if that's better.

borkdude 2022-03-19T17:08:10.914079Z

Yeah I'm ok with 0.8.0

๐Ÿ‘ 1
cap10morgan 2022-03-19T17:53:55.696719Z

where should we store the cache file for local pods? same dir as the pod binary?

cap10morgan 2022-03-19T17:54:11.510299Z

or somewhere in ~/.babashka/pods ?

borkdude 2022-03-19T17:54:19.276609Z

I think the latter would be nicer

borkdude 2022-03-19T17:54:39.678079Z

maybe we can make a sha512 of the bytes of the pod for the filename

borkdude 2022-03-19T17:55:06.062799Z

or so

borkdude 2022-03-19T17:55:23.907739Z

or just replace the file delimiter with a different char

borkdude 2022-03-19T17:55:53.137529Z

like ~/.babashka/pods/.cache/Users$borkdude$dev$pod-foobar.cache

cap10morgan 2022-03-19T17:56:58.341969Z

the hash of the pod binary itself is intriguing... solves cache invalidation and re-uses the cache even if you move it around. ๐Ÿค”

borkdude 2022-03-19T17:57:11.122749Z

agreed

borkdude 2022-03-19T17:57:30.241439Z

also no problems with relative path differences

cap10morgan 2022-03-19T17:57:36.192069Z

yep

cap10morgan 2022-03-19T17:58:20.269259Z

do we even need the :cache param w/ that?

borkdude 2022-03-19T17:58:39.885019Z

probably not :)

cap10morgan 2022-03-19T17:58:49.052579Z

I like it! good idea!

borkdude 2022-03-19T17:59:58.778899Z

well maybe it's still a good idea to be able to disable the cache in case we get our hashing wrong

borkdude 2022-03-19T18:00:35.045859Z

but we can try without first

borkdude 2022-03-19T18:00:38.302019Z

and solve that problem later

cap10morgan 2022-03-19T18:00:50.735079Z

sounds good

borkdude 2022-03-19T18:01:46.198719Z

I've got some hashing code in this library: https://github.com/nextjournal/dejavu

borkdude 2022-03-19T18:02:06.014309Z

which in turn uses mvxcvi/alphabase

borkdude 2022-03-19T18:02:11.318859Z

we can probably inline that code

cap10morgan 2022-03-19T18:03:50.548349Z

do you want it in base58 or is base64 ok? (assuming babashka has java.util.Base64 available)

borkdude 2022-03-19T18:05:36.209039Z

don't remember why we chose base58, maybe because it plays better with browser urls

borkdude 2022-03-19T18:05:52.019809Z

base64 is ok with me though

borkdude 2022-03-19T18:06:02.352429Z

provided that file delimiters aren't part of base64

cap10morgan 2022-03-19T18:06:12.844679Z

yeah, I'll double check

borkdude 2022-03-19T18:06:31.739869Z

so : , / and \\ should not be part of that set

cap10morgan 2022-03-19T18:09:13.285089Z

ok the url encoder can produce safe base64

borkdude 2022-03-19T19:29:48.233899Z

safe as in, safe file path?

borkdude 2022-03-19T19:29:52.450549Z

on Windows and linux?

borkdude 2022-03-19T19:30:54.286519Z

then it sounds good to me

borkdude 2022-03-19T19:31:32.427079Z

hmm, 63 is /

borkdude 2022-03-19T19:53:05.458699Z

ah right, URLEncoder should do the trick