# The Sage Command Line¶

The Sage Read-Eval-Print-Loop (REPL) is based on IPython. In this document, you’ll find how the IPython integration works. You should also be familiar with the documentation for IPython.

For more details about using the Sage command line, see the Sage tutorial.

## Running Sage¶

## Preparsing¶

Sage commands are “preparsed” to valid Python syntax. This allows
for example to support the `R.<x> = QQ[]`

syntax.

## Loading and attaching files¶

Sage or Python files can be loaded (similar to Python’s `execfile`

)
in a Sage session. Attaching is similar, except that the attached file
is reloaded whenever it is changed.

## Pretty Printing¶

In addition to making input nicer, we also modify how results are printed. This again builds on how IPython formats output. Technically, this works using a modified displayhook in Python.

## Display Backend Infrastructure¶

- Display Manager
- Display Preferences
- Output Buffer
- Basic Output Types
- Graphics Output Types
- Three-Dimensional Graphics Output Types
- Video Output Types
- Catalog of all available output container types.
- Base Class for Backends
- Test Backend
- The backend used for doctests
- IPython Backend for the Sage Rich Output System
- SageNB Backend for the Sage Rich Output System

## Miscellaneous¶

- Sage’s IPython Modifications
- Sage’s IPython Extension
- Magics for each of the Sage interfaces
- Interacts for the Sage Jupyter notebook
- Widgets to be used for the Sage Jupyter notebook
- Functions to construct widgets, based on the old SageNB interface.
- Installing the SageMath Jupyter Kernel and Extensions
- The Sage ZMQ Kernel
- Tests for the IPython integration
- HTML Generator for JSmol
- Sage Wrapper for Bitmap Images
- The Sage Input Hook