VizierDB / vizier-scala

The Vizier kernel-free notebook programming environment
Other
34 stars 11 forks source link

Fix brittle function export #284

Closed okennedy closed 9 months ago

okennedy commented 10 months ago

Describe the bug The current function export works with spit and duct tape, and there are multiple ways to break it. For example:

To Reproduce

def foo():
  print("hello")
bar = foo
vizierdb["x"] = bar

You will get a 50/50% chance of the export failing.

Alternatively, attempt to export a function imported from another file.

Expected behavior

Currently, Vizier uses a bit of a nasty hack to find the source code of the variable being assigned from. However, the __code__ field provides much of this metadata already. Notably:

okennedy commented 9 months ago

This should also open up the possibility of extracting symbols from different files more easily.