You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since IPython switched to jedi for autocompletion, they stopped evaluating code in @property methods.
This has the effect that the magic parameter attribute no longer works in these versions:
importconvisretina=convis.retina.Retina()
retina.p.<presstab># no completion options are shown
while the expected behaviour is that the options for each contained layer bipolar, gang_0_input, etc. are shown as a selection list.
The p attribute can be saved into a variable, in which case the layers can be accessed, but any further exploration needs to be assigned to a variable to be evaluated, which is not the idea behind convenient model exploration.
While jedi is mostly for static code analysis, they make some exceptions for code in an interactive environment. Maybe at some point they will make that exception also for @property evaluations.
IPython can be configured to not use jedi (but I would not want to recommended that).
There are some tricky ways around the issue that I can use from my side, but the most obvious one requires to instantiate all the objects at once, which takes away the advantage of lazy evaluation and adds a large overhead.
The bottom line is that for now, in the current IPython versions autocomplete of .p. is broken. Autocomplete to the layers still remains intact, so you can access the layers directly, but then have to manually decide which attributes are parameters and which have other purposes.
To inspect models in an Jupyter notebook, you can instead get a nice output of the model structure by putting the model as the last line in cell, causing the notebook to display the object or to get the full structure with all parameters you can use convis.describe(model).
Features like .p._all and .p._search still work, but require explicit execution as the last line of an IPython cell. In general, when autocomplete doesn't work, the options will also be visible when the object is printed or displayed in a notebook. If you are ok with making small cells that you execute often, this is a viable workaround.
## first cellimportconvisretina=convis.retina.Retina()
## second cellretina.p<executecell># shows options opl, ...# edit cellretina.p.opl._all<exceutecell># shows all parameters
Since IPython switched to
jedi
for autocompletion, they stopped evaluating code in@property
methods.This has the effect that the magic parameter attribute no longer works in these versions:
while the expected behaviour is that the options for each contained layer
bipolar
,gang_0_input
, etc. are shown as a selection list.The
p
attribute can be saved into a variable, in which case the layers can be accessed, but any further exploration needs to be assigned to a variable to be evaluated, which is not the idea behind convenient model exploration.While
jedi
is mostly for static code analysis, they make some exceptions for code in an interactive environment. Maybe at some point they will make that exception also for@property
evaluations.IPython can be configured to not use
jedi
(but I would not want to recommended that).There are some tricky ways around the issue that I can use from my side, but the most obvious one requires to instantiate all the objects at once, which takes away the advantage of lazy evaluation and adds a large overhead.
The bottom line is that for now, in the current IPython versions autocomplete of
.p.
is broken. Autocomplete to the layers still remains intact, so you can access the layers directly, but then have to manually decide which attributes are parameters and which have other purposes.To inspect models in an Jupyter notebook, you can instead get a nice output of the model structure by putting the model as the last line in cell, causing the notebook to
display
the object or to get the full structure with all parameters you can useconvis.describe(model)
.Features like
.p._all
and.p._search
still work, but require explicit execution as the last line of an IPython cell. In general, when autocomplete doesn't work, the options will also be visible when the object isprint
ed ordisplay
ed in a notebook. If you are ok with making small cells that you execute often, this is a viable workaround.See also
no completions for @property decorated methods in Interpreter mode #1259
No auto-completion for dynamic attributes #997
(closed) Interpreter completions ignore
__dir__()
method #1027(closed) Completion broken for objects with custom dir method #10977
The text was updated successfully, but these errors were encountered: