Session Info 2
Session Info 2 is a Python library that prints detailed version information for all currently imported packages and system details, useful for debugging and reproducibility. It's an improved successor to the original `session-info` library. The current version is 0.4.1, with releases occurring every few months to add features and improvements.
Warnings
- gotcha This library (`session-info2`) is a distinct successor to the original `session-info` package. While the primary import module is similar (`session_info`), their implementations and features differ. Ensure you install `session-info2` if you intend to use the newer features and improved package discovery.
- breaking In version 0.1.2, the default output format for `session_info.show()` changed from JSON to plain text (or rich terminal output). If your scripts relied on parsing JSON directly from the default output, you now need to explicitly specify `session_info.show(display_mode='json')`.
- gotcha The `.format('markdown' | 'html' | ...)` method was introduced in v0.4. If you are on an older version and need formatted output, you must use the `display_mode` argument directly, e.g., `session_info.show(display_mode='markdown')`.
Install
-
pip install session-info2
Imports
- show
from session_info import show
Quickstart
import session_info
# Print session information to stdout
session_info.show()
# To get formatted output (e.g., markdown) in v0.4+
# result = session_info.show(display_mode='text') # captures string for earlier versions
# print(result)
# In v0.4+, you can also chain .format()
# print(session_info.show().format('markdown'))