Comments (2)
Actually, I think this could be done in attrsub_tracer
without too much difficulty. Whenever the obj_name
parameter is non-null, then we can lookup the corresponding symbol in the tracer's current active scope and mark it as a dynamic usage. This is true regardless of whether the final object in the chain ends up being loaded, stored, or deleted. When obj_name
is null, typically the actual obj is being returned from somewhere else and we don't need to worry about marking its corresponding symbol as dynamically used since that will happen at that same somewhere else.
We do, however, need to mark methods as used, and this might require some extra work since we can't just use obj_name
for these.
from ipyflow.
Untested code for attrsub_tracer
that might get us most of the way there:
if sym_for_obj is None and obj_name is not None:
sym_for_obj = self.active_scope.lookup_data_symbol_by_name_this_indentation(obj_name)
if sym_for_obj is not None and sym_for_obj.defined_cell_num < nbs().cell_counter():
sym_for_obj.version_by_used_timestamp[nbs().cell_counter()] = sym_for_obj.defined_cell_num
Can insert this snippet right below this line in attrsub_tracer.
This is untested though and there may be more to do there. For example, If we have
obj.foo()['bar']
I don't know whether it will correctly identify the usage of obj.foo
(whose usage is not captured by the code snippet above; obj_name
will be None
since the object being subscripted is the thing that gets retuned from obj.foo()
, not obj.foo
).
Also it's worth testing on various aliasing scenarios.
from ipyflow.
Related Issues (20)
- add time travel slider to code widget
- register comm target on frontend for allowing non-ipyflow kernels to broadcast capabilities HOT 1
- add to conda-forge HOT 1
- Execute in reverse: Execute cells required for a cell to execute HOT 10
- Creating Cell Flow Graph Without Ipython HOT 11
- add kernel hook for after execute_reply sent
- add batch reactivity mode
- make basic execution path jupyter-agnostic by inheriting InteractiveShell HOT 2
- improve %load_ext to work with other kernels that wrap IPythonKernel
- [lab] enable reactive execution for "run selected"
- allow tracing to resume during function execution HOT 2
- persist dependencies in notebook metadata and apply after notebook restarts HOT 1
- certain cell executions produce "file changed on disk" popup HOT 1
- add button or hotkey for fusing all cells in forward / backward / full slice into one cell
- ipyflow kernel incompatible with google colab HOT 5
- Explore using sys.monitoring for instrumentation on 3.12
- Don't use persisted dag in ipynb metadata if another kernel was used
- Add %%memoize cell magic or equivalent HOT 3
- improve pdb compatibility
- upsert symbols for starred imports
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipyflow.