or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration-utilities.mdcore-shell.mddisplay-system.mdextension-system.mdindex.mdmagic-system.mdterminal-interface.md
tile.json

tessl/pypi-ipython

IPython: Productive Interactive Computing - An advanced interactive computing environment and command shell for Python.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/ipython@9.5.x

To install, run

npx @tessl/cli install tessl/pypi-ipython@9.5.0

index.mddocs/

IPython

IPython is an advanced interactive computing environment and command shell that extends the standard Python REPL with powerful features including comprehensive object introspection, persistent input history with session caching, extensible tab completion, a rich system of magic commands, configurable environments with profile switching, session logging and reloading capabilities, extensible syntax processing, integrated system shell access, easy embedding in other Python programs, and integrated access to debugging and profiling tools.

Package Information

  • Package Name: ipython
  • Language: Python
  • Installation: pip install ipython
  • Python Version: >=3.11

Core Imports

import IPython

Common usage patterns:

from IPython import start_ipython, embed, get_ipython
from IPython.display import display, HTML, Markdown, Image, Video, Audio, Javascript
from IPython.lib.display import FileLink, YouTubeVideo
from IPython.core.magic import line_magic, cell_magic, magics_class

Basic Usage

import IPython

# Start a full IPython session
IPython.start_ipython()

# Embed IPython in current scope for debugging
def my_function():
    data = {"key": "value"}
    IPython.embed()  # Drops into IPython shell with access to local variables
    return data

# Get current IPython instance
ipython = IPython.get_ipython()
if ipython is not None:
    ipython.run_cell("print('Hello from IPython!')")

Architecture

IPython follows a modular architecture with several key components:

  • InteractiveShell: Core interactive environment managing execution, history, and state
  • Magic System: Extensible command system for special functionality (% and %% commands)
  • Display System: Rich output formatting and media display capabilities
  • Extension System: Plugin architecture for adding custom functionality
  • Configuration System: Traitlets-based configuration with profiles and persistent settings
  • Terminal Interface: Advanced terminal integration with syntax highlighting and completion

This design enables IPython to serve as both a standalone interactive environment and an embeddable component for building custom interactive applications.

Capabilities

Core Shell Functions

Primary entry points for starting IPython sessions, embedding interactive shells, and managing the current IPython instance.

def start_ipython(argv=None, **kwargs):
    """Launch a normal IPython instance (as opposed to embedded)"""

def embed(header='', compile_flags=None, **kwargs):
    """Embed and start IPython in a given scope"""

def get_ipython():
    """Get the currently running InteractiveShell instance, or None if not in IPython"""

Core Shell

Magic System

Extensible command system providing special functionality through % (line) and %% (cell) magic commands, plus framework for creating custom magics.

@magics_class
class MyMagics(Magics):
    pass

@line_magic
def my_magic(self, line):
    """A simple line magic"""

@cell_magic  
def my_cell_magic(self, line, cell):
    """A simple cell magic"""

Magic System

Display System

Rich output formatting and media display capabilities for presenting HTML, images, videos, interactive widgets, and custom representations.

def display(*objs, include=None, exclude=None, metadata=None, **kwargs):
    """Display objects with rich formatting"""

class HTML(DisplayObject):
    """HTML display object"""

class Image(DisplayObject):
    """Image display object"""

Display System

Extension System

Plugin architecture for loading and managing IPython extensions that add custom functionality, magic commands, and hooks.

def load_ipython_extension(ipython):
    """Extension loading entry point"""

def unload_ipython_extension(ipython):
    """Extension unloading entry point"""

class ExtensionManager:
    """Manages loading and unloading of extensions"""

Extension System

Terminal Interface and Embedding

Advanced terminal integration with syntax highlighting, tab completion, keyboard shortcuts, and embedding capabilities for interactive debugging.

class TerminalInteractiveShell(InteractiveShell):
    """Terminal-based interactive shell"""

def embed(header='', compile_flags=None, **kwargs):
    """Embed IPython in current scope"""

Terminal Interface

Configuration and Utilities

Configuration management through profiles, path utilities for IPython directories, and system information functions.

def get_ipython_dir():
    """Get the IPython directory path"""

def locate_profile(profile='default'):
    """Find a profile directory"""

def sys_info():
    """Get system information"""

Configuration and Utilities

Types

class InteractiveShell:
    """Core interactive shell implementation"""
    
    def run_cell(self, raw_cell, store_history=True, silent=False, shell_futures=True):
        """Execute a code cell"""
    
    def complete(self, text, line=None, cursor_pos=None):
        """Perform tab completion"""
    
    def object_inspect(self, oname, detail_level=0):
        """Inspect an object"""

class DisplayObject:    
    """Base class for rich display objects"""
    
    def __init__(self, data=None, url=None, filename=None, metadata=None):
        pass

class Magics:
    """Base class for magic command collections"""
    
    def __init__(self, shell=None):
        pass