You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure how feasible this is, but we should definitely work towards making it possible to use Lilypad inside of a Jupyter Notebook since many developers work there.
The text was updated successfully, but these errors were encountered:
@willbakst
I investigated this issue and found that implementing Jupyter Notebook support would be quite challenging.
The key technical issues:
When executing Closure.from_fn(fn)) in Jupyter Notebooks, it fails because code runs in __main__ as a virtual module.
While we can access the code and user namespace through module.In and module.get_ipython().user_ns, we can't get the source code. Our code uses inspect.getsource(getattr(self.module, node.id, None))) to extract source code from modules, but modules in Jupyter's user_ns don't provide source-related information like __code__ or __file__. This makes it impossible to extract the actual code for target objects.
To solve this, we would need to:
Resolve referenced names (ast.Name) during AST traversal
Extract corresponding code for those references
This would require either:
Using third-party libraries for AST traversal
Or implementing our own reference resolution table
Due to the complexity of these changes, I decided not to implement this solution at this time.
Ok, let's put this on hold for the time being then. We can take a deeper look and evaluate later how much time we're willing to spend on this / possible other paths that could be easier to implement but sacrifice completeness.
My gut feeling is that we'll want to implement our own solution if feasible.
Description
Not sure how feasible this is, but we should definitely work towards making it possible to use Lilypad inside of a Jupyter Notebook since many developers work there.
The text was updated successfully, but these errors were encountered: