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:
__code__.co_name is the name under which the function is defined (this fixes the 50/50 failure chance named above)
__code__.co_filename is the file that provided the function (this should address the import issue)
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
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:__code__.co_name
is the name under which the function is defined (this fixes the 50/50 failure chance named above)__code__.co_filename
is the file that provided the function (this should address the import issue)