Registry / web-framework / flask-shell-ipython

flask-shell-ipython

JSON →
library0.5.3pypypiunverified

Flask-Shell-IPython (current version 0.5.3, released September 2024) is a Python package that seamlessly replaces the default `flask shell` command with an enhanced IPython shell. This integration provides developers with advanced interactive features such as syntax highlighting, tab-completion, command history, and IPython's "magic commands," significantly improving the Flask development and debugging experience. The project maintains an active development status with periodic updates.

web-framework
Install & Compatibility
Where this runs
tested against v0.5.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/5 runs
4/5 runs
py 3.11
4/5 runs
4/5 runs
py 3.12
4/5 runs
4/5 runs
py 3.13
4/5 runs
4/5 runs
py 3.9
4/5 runs
4/5 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The primary feature of `flask-shell-ipython` is that it automatically hooks into the `flask shell` command upon installation. No explicit import or initialization code is required in your Flask application for basic usage. Configuration is done via `app.config['IPYTHON_CONFIG']` if custom IPython settings are desired.

No explicit import needed; installation automatically replaces `flask shell`.

This quickstart demonstrates a minimal Flask application that automatically uses the IPython shell when `flask shell` is executed. It also shows how to configure IPython settings and how to add custom objects (like `app` and `greeting`) to the shell's context using Flask's `shell_context_processor`.

from flask import Flask app = Flask(__name__) # Optional: Configure IPython settings via Flask app.config app.config['IPYTHON_CONFIG'] = { 'InteractiveShell': { 'colors': 'Linux', 'confirm_exit': False, }, } @app.route('/') def hello(): return "Hello, World!" # To make your app and any models/database objects available in the shell context, # define a shell context processor. @app.shell_context_processor def make_shell_context(): # In a real application, you would import your models and database instance here # e.g., from .models import User, Post # e.g., from .extensions import db return dict(app=app, greeting="Hello from shell context!") # To run the IPython shell, save this file as app.py (or your preferred name) # and execute in your terminal: # FLASK_APP=app.py flask shell # You should see the IPython prompt, and 'app' and 'greeting' will be available.
flask --version
Debug
Known footguns
gotchaUnlike many Flask extensions, `flask-shell-ipython` requires no explicit import or `init_app` call. Its functionality automatically replaces the `flask shell` command upon installation. Attempting to import or initialize it manually is unnecessary and will not yield the expected results.
gotchaEnsure your Python and Flask versions are compatible. `flask-shell-ipython` requires Python `>=3.8, <4.0`. Be mindful of Flask's own deprecations and minimum version requirements (e.g., Flask 2.0 dropped Python 2/3.5, Flask 3.0 requires Werkzeug >= 3.0), as these can indirectly affect `flask-shell-ipython`'s operational environment.
gotchaWhen testing `flask-shell-ipython` (or applications using it) on Windows, be aware that the `pytest-forked` plugin, which is often recommended for ensuring isolated IPython instances during testing, does not work.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
12 hits · last 30 days
gptbot
4
ahrefsbot
3
bytedance
2
script
1
googlebot
1
Resources