Summary
Enable env-doctor check to render rich HTML output when running inside Jupyter/IPython notebooks instead of terminal-formatted text.
Motivation
Data scientists and ML engineers frequently work in Jupyter notebooks. Currently, running !env-doctor check in a notebook produces raw terminal output with ANSI escape codes that render poorly. Native HTML output
would make env-doctor a natural part of the notebook workflow.
Proposed Implementation
Runtime Detection
- Detect Jupyter/IPython environment:
def is_notebook():
try:
from IPython import get_ipython
shell = get_ipython().__class__.__name__
return shell == 'ZMQInteractiveShell' # Jupyter
except (ImportError, AttributeError):
return False
HTML Output Formatter
- Create format_result_html(result: DetectionResult) -> str utility
- Use inline CSS for portable HTML (no external stylesheets)
- Color-coded status badges: green (success), yellow (warning), red (error)
- Collapsible sections for detailed metadata
- Render via IPython.display.HTML()
Python API
- Expose a simple Python API for notebook use:
from env_doctor import check
check() # auto-detects notebook, renders HTML
- Falls back to terminal output if not in a notebook
CLI Flag
- Add --format html flag for explicit HTML output (useful for CI reports too)
Acceptance Criteria
- Auto-detects Jupyter environment and switches to HTML output
- from env_doctor import check; check() works in notebooks
- HTML output is self-contained (inline CSS, no external deps)
- All existing check information rendered (status, versions, issues, recommendations)
- Terminal output unchanged when not in notebook
- --format html flag available for explicit HTML output
Summary
Enable
env-doctor checkto render rich HTML output when running inside Jupyter/IPython notebooks instead of terminal-formatted text.Motivation
Data scientists and ML engineers frequently work in Jupyter notebooks. Currently, running
!env-doctor checkin a notebook produces raw terminal output with ANSI escape codes that render poorly. Native HTML outputwould make env-doctor a natural part of the notebook workflow.
Proposed Implementation
Runtime Detection
HTML Output Formatter
Python API
from env_doctor import check
check() # auto-detects notebook, renders HTML
CLI Flag
Acceptance Criteria