-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing variables from previous notebook cells #6
Comments
@nonatomiclabs: I will definitely look into the what would make the above possible keeping the API contract as simple as it is now. In the meantime, you can use https://github.com/csurfer/pyheat as a command line and use it on an entire file that way all your variables and the methods which access them are in one single file and you get an approximate idea of the bottlenecks in code. P.S https://github.com/csurfer/pyheat is a pet project of mine which powers pyheatmagic. |
Great, thank you very much. About PyHeat, I'm not sure it's a real solution here, as:
|
Are either of the solutions in this stackoverflow thread ( |
I've noticed issues with trying to refer to variables that are used outside of the function (for examples, variables defined in previous cells that are then passed into the function). Is one way round this to allow those variables to be passed into the magic? eg using a pattern along the lines of:
where the |
@csurfer |
The only way I see is to paste all you need to trace on the same cell. |
You can also merge multiple cells just for doing "heat magic" selecting multiple cells and then The other is in git, save your work before doing the merge if you want to restore the cells as they where. |
This issue is a definitive no-go for me (and I suspect many others), since any significantly complex analysis pipeline will start involving writing functions that you want to reuse from cells to cells (DRY code) and you don't want to start wrapping hundreds of lines within a single cell anytime you want to profile some snippet of code involving functions. That would just be a messy way to work. Seems to me that the problem is that the heat magic does not have access to local variables and functions. Maybe using the |
Usually, one can access from the current notebook cell variables from previous cells (for instance, we define
a
in cell 2 and access it in 3). However, I can not get that to work when using heat (example in cell 4), which is sometimes annoying (especially when creating such variable can take up some time).Full traceback (click to expand)
Would it be possible to add that feature? I have never worked on iPython extensions, but I would be glad to contribute to that one, if I'm pointed to the right part of code to improve.
Anyway, thank you for the great extension 👏
The text was updated successfully, but these errors were encountered: