Fork me on GitHub
#portal
<
2022-10-16
>
djblue05:10:59

Okay, hear me out...

💯 5
🔥 6
♥️ 1
djblue07:10:43

Those grays are just different enough that it hurts 😆, need to add a clerk theme

pfeodrippe13:10:28

Just lovely ahahahaha 🙏

mkvlr18:10:37

hey Chris, pretty funny. Curious what made you build this, just for fun or do you have an actual use case?

djblue18:10:33

Portal recently https://github.com/djblue/portal/releases/tag/0.30.0 for https://calva.io/notebooks/ as a renderer, which got me thinking about what integrating portal into clerk would look like. My main motivation is to author notebooks to document viewers with live examples. These notebooks should work at the clojure repl, in a calva notebook and in a clerk notebook since the common format is a clojure file.

djblue18:10:09

It actually was pretty easy getting it working in clerk 💯

djblue18:10:42

This version of a portal viewer wouldn't work with the static site generation, but that would be easy to add via the https://github.com/djblue/portal/blob/master/doc/guides/standalone.md.

djblue18:10:05

My other main goal is allowing users to utilize portal in their preferred context

mkvlr19:10:54

standalone portal looks neat

mkvlr19:10:27

need to take a closer look at the Calva integration

mkvlr19:10:43

ah I see you’re embedding the iframe

mkvlr19:10:25

I guess it should be possible to embed it in the same context if you take over ClojureScript compilation and make a bundle with Clerk’s and Portals CLJS code in it

mkvlr19:10:08

> My main motivation is to author notebooks to document viewers with live examples. Embedding them in the same context should get the static build working (in case you want to publish those notebooks 👆 via Clerk’s static publishing)

salam21:10:12

👍 for the light theme! 😜

Ben Sless06:10:28

Trying to get a colleague to use portal, found out the hard way the API to get to logging renderer isn't straightforward. Thoughts in thread

djblue06:10:41

Is the spec for the data too restrictive?

Ben Sless06:10:41

Not everyone uses timbre Assuming we don't want to introduce into source code something new outside of Clojure core, how can portal hitch itself onto it? How about injecting an inline metadata to tap, then massaging the tap target based on metadata attached to the form?

Ben Sless06:10:57

The spec is way too restrictive and not discoverable

Ben Sless06:10:50

Imagine a ^:portal/log metadata which would build the correct message

djblue06:10:09

I am working on viewer level docs and am very open to loosening up the spec

djblue06:10:21

The logging spec isn't based on timbre. The docs have a mapping from timbre to the log viewer.

Ben Sless06:10:38

yeah, but the only example is very tied to timbre

djblue06:10:19

https://github.com/seancorfield/dot-clojure/blob/develop/dev.clj#L86-L116 is how you can do it with tools logging, which I'm hoping to add to the docs soon

Ben Sless06:10:39

Was thinking about something like (alter-meta! #'tap install-viewers-meta)

Ben Sless06:10:16

and build the correct tap object on portal's side instead of user's side

Ben Sless06:10:23

according to the meta on the target

djblue06:10:21

Wait, so what does the data look like that lives on the user's side?

Ben Sless06:10:39

normal, a user would just (tap> x)

Ben Sless06:10:34

the inliner would use metadata provided by the compiler to build the required data

djblue06:10:42

I guess I'm confused about what this inliner would look like outside of a clojure macro

djblue06:10:09

Ohh, I think I understand what you mean

djblue06:10:14

I would prefer people use portal.console instead of monkey patching a clojure core fn

djblue06:10:39

However, providing people a guide to do it would be reasonable 👌

djblue06:10:12

Another option I've been thinking about to make it easier to use portal.console is adding a reader tag, something like #portal/log .

djblue06:10:38

It could do one of two thing. It could produce the log map which can then be sent to tap> or it could tap> the map itself, not sure which is better :thinking_face:

Ben Sless06:10:35

Data > effects

💯 1
Ben Sless06:10:28

A reader tag would be great

👍 1
djblue06:10:57

What parts of the spec were causing issues / annoying?

djblue07:10:15

Was it easy to satisfy the requirements after you found the spec?

Ben Sless07:10:06

No, date's pred being JavaScript was opaque for me

👍 1
djblue07:10:56

If you saw (s/def ::time inst?) in the docs, would you have know a java date would also work from clj land?

djblue07:10:20

Not sure why I have a custom one in the viewer, but i think inst? is the correct predicate

Ben Sless07:10:03

That's a Clojure problem that it doesn't tell me which types satisfy inst?

Ben Sless07:10:07

Why Date and not Instant?

Ben Sless07:10:20

And, iirc, I had to send a long eventually, not an instant

Ben Sless07:10:43

also, if we're just tracing values chronologically, I find I don't have anything to do with the log level. I care about time and place, less about level

Ben Sless07:10:41

Also, leiningen instructions would be beneficial for legacy users 🙂

djblue07:10:52

I'm surprised the long worked :thinking_face:

djblue07:10:09

What type of instructions? Like in the readme on how to start the project?

Ben Sless07:10:34

yes, how to add it to a project or to the ~/.lein/profiles.clj

Ben Sless07:10:22

We tend to assume everyone knows their tooling well, but it turns out most people are there for a job not because if they couldn't do Clojure they'd quit and go be a carpenter :man-shrugging:

😆 3
djblue07:10:02

Would you mind putting a PR for the lein stuff? Not very familiar with the best way to use it.

djblue07:10:37

Also, thanks for sharing all this feedback 🙏

Ben Sless07:10:11

Gladly and with pleasure. Least I can do 🙂

djblue22:10:54

I added https://github.com/djblue/portal/blob/master/doc/guides/portal-console.md#spec for now to help people in the future who run into these issues 👌