### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 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__`(shell=None, history=None)
  `continuation_prompt`()
    Returns the current continuation prompt
  `execute`(block, blockID=None)

    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`(current_block)
    Returns previous history string and decrement history cursor.
  `input_prompt`(number='')

    Returns the current input prompt

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

  `is_complete`(block)

    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`(number='')
    Returns the output prompt for result
  `render_error`(failure)

    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`(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`(result, blockID=None)

    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

  static `__init__`(name, bases=(), attrs=None, __doc__=None, __module__=None)

### `IFrontEndFactory`

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

  Bases: `zope.interface.Interface`

  Factory interface for frontends.

  static `__init__`(name, bases=(), attrs=None, __doc__=None, __module__=None)

### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 documentation »
- The IPython API »