Almond Scala Kernel API: Not Working

Hi,

I am writing a library that makes use of the almond scala kernel. I am following this example:

Example

I simplify this example to just the following in my code:

def writeHTMLToJupyter()(implicit kernel: almond.api.JupyterApi): Unit = {
val data = DisplayData(Map(“text/html” -> “Some HTML”))
kernel.publish.display(data)
}

As can be seen, the function signature passes in an implicit parameter as per the example.

I then compile the code and get the following issue:

could not find implicit value for parameter kernel: almond.api.JupyterApi

Why is this happening? I know I can import almond.api.JupyterApi without any issues.

If someone could explain that would be much appreciated!

More examples in the docs here: https://almond.sh/docs/api-jupyter

1 Like

Hmm. I don’t know Almond at all, but it might be helpful to see your import statement, and how the imported object is documented. For example, you might be importing just the type, but not the implicit instance, or something like that.

2 Likes

Thanks @jducoeur, I actually got it fixed based on your hint about import statements. The issue was I was calling this function from another, which did not have the implicit defined!

2 Likes