{"id":6238,"library":"session-info2","title":"Session Info 2","description":"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.","status":"active","version":"0.4.1","language":"en","source_language":"en","source_url":"https://github.com/flying-sheep/session-info2","tags":["environment","versioning","debugging","introspection","reproducibility"],"install":[{"cmd":"pip install session-info2","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"The package is `session-info2` but the main module to import is `session_info`.","wrong":"import session_info2","symbol":"show","correct":"from session_info import show"}],"quickstart":{"code":"import session_info\n\n# Print session information to stdout\nsession_info.show()\n\n# To get formatted output (e.g., markdown) in v0.4+\n# result = session_info.show(display_mode='text') # captures string for earlier versions\n# print(result)\n\n# In v0.4+, you can also chain .format()\n# print(session_info.show().format('markdown'))","lang":"python","description":"The most common way to use `session-info2` is to simply call `session_info.show()`. This will print a comprehensive summary of your Python environment, including package versions and system details, directly to the console. As of v0.4, you can also use the `.format()` method on the returned object for specific output types."},"warnings":[{"fix":"Confirm you have installed `session-info2` (and not `session-info`) using `pip show session-info2`. If migrating, be aware of behavioral changes.","message":"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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For JSON output, call `session_info.show(display_mode='json')` or, for v0.4+, `print(session_info.show().format('json'))`.","message":"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')`.","severity":"breaking","affected_versions":">=0.1.2"},{"fix":"Upgrade to `session-info2>=0.4` to use the `.format()` method, or use `session_info.show(display_mode='...')` for older versions.","message":"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')`.","severity":"gotcha","affected_versions":"<0.4"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}