ipynb icon indicating copy to clipboard operation
ipynb copied to clipboard

Implement better dependency tracking for ipynb.fs.defs

Open yuvipanda opened this issue 9 years ago • 4 comments

Right now, we only include assignments where the LHS is all caps. However, LHS all caps might have dependencies on RHS that's not all caps. These will not be evaluated, causing strange amounts of confusion.

Instead, we should attempt to track the dependencies on the RHS of such assignments, and eval those too (recursively). We should do this in such a way that the rules are very clear to explain to people.

This should still only be done for top level imports though.

yuvipanda avatar Nov 08 '16 18:11 yuvipanda

Hmm, can we get away with supporting only top-level things? What do we do with:

if a == 5:
    b = 6

C = b * 5

In this case I'll have to include all the the code, including the if (and the dependent a definition, wherever that comes from).

yuvipanda avatar Nov 08 '16 18:11 yuvipanda

And what do you do with:

if a == 5:
    b = 6
else:
    b = 9
    doSomethingReallyExpensiveWithLotsOfSideEffects()

C = b * 5

Do we strip out doSomethingReallyExpensiveWithLotsOfSideEffects() but leave b = 9? That seems like very unintuitive behavior.

yuvipanda avatar Nov 08 '16 19:11 yuvipanda

@ellisonbg suggested we use notebook tags, and I like that much better than magical solutions that involve AST munging or bytecode disassembly.

yuvipanda avatar Nov 10 '16 18:11 yuvipanda

FWIW, we went down the same introspection path in https://github.com/jupyter-incubator/contentmanagement and instead backed off to using comment syntax as a stopgap tagging UI.

parente avatar Nov 10 '16 21:11 parente