Skip to content
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

add parent to Configurable #3430

Merged
merged 6 commits into from
Jul 1, 2013
Merged

add parent to Configurable #3430

merged 6 commits into from
Jul 1, 2013

Commits on Jun 29, 2013

  1. add parent to Configurable

    this adds the notion of a parent and member config,
    so the config:
    
        c.Foo.Bar.attr = value
    
    will only set `Bar.attr = value` for `Bar` instances
    which are members of `Foo` instances.
    The mechanism for doing this is
    
    ```python
    f = Foo(config=cfg)
    f.b = Bar(parent=f)
    ```
    
    This Instance config has higher priority than plain class config for Bar,
    but still lower priority than direct keyword arg trait assignment.
    
    The main implication this has is to change the standard creation of descendants:
    
    ```python
    self.bar = Bar(config=self.config)
    ```
    
    into a direct parent expression
    
    ```python
    self.bar = Bar(parent=self)
    ```
    
    This also means that most Configurables will actually have a handle on their parent object.
    minrk committed Jun 29, 2013
    Configuration menu
    Copy the full SHA
    7f44a56 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    447f122 View commit details
    Browse the repository at this point in the history
  3. use parent=self throughout IPython

    instead of `config=self.config`
    
    only real effective change: IPythonKernelApp.parent has been renamed to IPKernelApp.parent_handle.
    minrk committed Jun 29, 2013
    Configuration menu
    Copy the full SHA
    3bd1272 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3988304 View commit details
    Browse the repository at this point in the history
  5. allow multi-level Config parentage

    now Foo.Bar.Baz can affect a Baz whose parent is Bar whose parent is Foo.
    
    More specificity = higher priority, so Foo.Bar.Baz > Bar.Baz > Baz.
    minrk committed Jun 29, 2013
    Configuration menu
    Copy the full SHA
    5f65cd6 View commit details
    Browse the repository at this point in the history
  6. check parent is not None rather than not parent

    Configurables often resolve to zero for some reason
    minrk committed Jun 29, 2013
    Configuration menu
    Copy the full SHA
    23e1cba View commit details
    Browse the repository at this point in the history