frontend.frontendbase — IPython 0.10.2 documentation

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »

# frontend.frontendbase

## Module: `frontend.frontendbase`

Inheritance diagram for `IPython.frontend.frontendbase`:

frontendbase provides an interface and base class for GUI frontends for IPython.kernel/IPython.kernel.core.

Frontend implementations will likely want to subclass FrontEndBase.

Author: Barry Wark

## Classes

### `FrontEndBase`

class `IPython.frontend.frontendbase.` `FrontEndBase`(shell=None, history=None)

  Bases: `object`

  FrontEndBase manages the state tasks for a CLI frontend:
    - Input and output history management
    - Input/continuation and output prompt generation
  Some issues (due to possibly unavailable engine):
    - How do we get the current cell number for the engine?
    - How do we handle completions?
  `__init__`()
  `continuation_prompt`()

    Returns the current continuation prompt

  `continuation_prompt_template` = <string.Template object at 0x5883050>
  `execute`()

    Execute the block and return the result.

    Parameters:

      block : {str, AST} blockID : any

      > Caller may provide an ID to identify this block. result[‘blockID’] := blockID

    Result:
      Deferred result of self.interpreter.execute
  `get_history_next`()

    Returns next history string and increment history cursor.

  `get_history_previous`()

    Returns previous history string and decrement history cursor.

  `history_cursor` = 0
  `input_prompt`()

    Returns the current input prompt

    It would be great to use ipython1.core.prompts.Prompt1 here

  `input_prompt_template` = <string.Template object at 0x5883450>
  `is_complete`()

    Determine if block is complete.

    Parameters block : string

    Result True if block can be sent to the engine without compile errors. False otherwise.

  `output_prompt`()

    Returns the output prompt for result

  `output_prompt_template` = <string.Template object at 0x5883610>
  `render_error`()

    Subclasses must override to render the failure.

    In asynchronous frontends, this method will be called as a twisted.internet.defer.Deferred’s callback. Implementations should thus return result when finished.

  `render_result`()

    Subclasses must override to render result.

    In asynchronous frontends, this method will be called as a twisted.internet.defer.Deferred’s callback. Implementations should thus return result when finished.

  `update_cell_prompt`()

    Subclass may override to update the input prompt for a block.

    This method only really makes sens in asyncrhonous frontend. Since this method will be called as a twisted.internet.defer.Deferred’s callback, implementations should return result when finished.

### `IFrontEnd`

class `IPython.frontend.frontendbase.` `IFrontEnd`(name, bases=(), attrs=None, __doc__=None, __module__=None)

  Bases: `zope.interface.Interface`

  Interface for frontends. All methods return t.i.d.Deferred

  classmethod `__init__`()
  `dependents` = <WeakKeyDictionary at 109697432>

### `IFrontEndFactory`

class `IPython.frontend.frontendbase.` `IFrontEndFactory`(name, bases=(), attrs=None, __doc__=None, __module__=None)

  Bases: `zope.interface.Interface`

  Factory interface for frontends.

  classmethod `__init__`()
  `dependents` = <WeakKeyDictionary at 109697504>

### Navigation

- index
- modules |
- next |
- previous |
- IPython 0.10.2 documentation »
- The IPython API »