{"id":4255,"library":"session-info","title":"session-info","description":"The `session-info` Python library (module name `session_info`) provides a simple way to output version information for modules loaded in the current session, Python interpreter, operating system, and CPU. It aims to improve reproducibility, especially in interactive environments like Jupyter notebooks. The current version is 1.0.1, released in May 2021, suggesting an infrequent release cadence for this specific package.","status":"active","version":"1.0.1","language":"en","source_language":"en","source_url":"https://gitlab.com/joelostblom/session_info","tags":["environment","reproducibility","versions","notebooks","debugging","session","info"],"install":[{"cmd":"pip install session-info","lang":"bash","label":"PyPI"},{"cmd":"conda install -c conda-forge session-info","lang":"bash","label":"Conda"}],"dependencies":[{"reason":"Used to distinguish between standard library and third-party modules.","package":"stdlib_list","optional":false}],"imports":[{"note":"The package installs a module named `session_info`, which is then imported directly.","wrong":"from session_info import session_info","symbol":"session_info","correct":"import session_info"}],"quickstart":{"code":"import pandas\nimport numpy\nimport session_info\n\n# Basic usage to show loaded third-party modules, Python, and OS info\nsession_info.show()\n\n# To include standard library modules (e.g., 'math')\n# import math\n# session_info.show(std_lib=True)\n\n# To include recursive dependencies of imported modules\n# session_info.show(dependencies=True)","lang":"python","description":"This quickstart demonstrates the basic use of `session_info.show()` to print environmental and module version details. It also highlights common optional arguments like `std_lib` to include standard library modules and `dependencies` to show sub-dependencies."},"warnings":[{"fix":"Uninstall `sinfo` and install `session-info` using `pip install session-info`. Update imports from `from sinfo import sinfo` to `import session_info` and function calls from `sinfo()` to `session_info.show()`.","message":"The package was renamed from `sinfo` to `session-info` (with the primary module becoming `session_info`). While the old `sinfo` PyPI package is kept for backward compatibility, new features and bug fixes are only applied to `session-info`. Users should migrate to the new package.","severity":"breaking","affected_versions":"<1.0.0 (sinfo)"},{"fix":"To include standard library modules in the output, call `session_info.show(std_lib=True)`.","message":"By default, `session_info.show()` only lists third-party packages. Standard library modules (e.g., `math`, `os`) are omitted from the output.","severity":"gotcha","affected_versions":"1.0.0+"},{"fix":"To include not only explicitly imported modules but also their dependencies, use `session_info.show(dependencies=True)`.","message":"The `session_info.show()` function, by default, only lists explicitly imported top-level modules. It does not automatically show their internal or recursive dependencies.","severity":"gotcha","affected_versions":"1.0.0+"},{"fix":"To obtain plain text output in Jupyter Notebooks, use `session_info.show(html=False)`.","message":"When used within a Jupyter Notebook, `session_info.show()` renders its output with HTML formatting by default. If plain text output is preferred, this needs to be explicitly specified.","severity":"gotcha","affected_versions":"1.0.0+"},{"fix":"To save the output, you typically need to redirect standard output in your script (e.g., using `contextlib.redirect_stdout`) or capture the output of `session_info.show()` and write it to a file manually.","message":"This specific `session-info` package (v1.0.1) does not provide a direct function to save its output to a file (e.g., `to_file()`). Users often expect this functionality for sharing or logging.","severity":"gotcha","affected_versions":"1.0.0+"},{"fix":"Always explicitly `pip install session-info` and use `import session_info` for this library. If you intend to use the newer library, install `session-info2` and use `from session_info2 import session_info`.","message":"There is a similarly named, more recently updated Python package called `session-info2` (latest v0.4, Feb 2026). It uses a different import pattern (`from session_info2 import session_info`). Ensure you install and import the correct package if aiming for `session-info` (v1.0.1).","severity":"gotcha","affected_versions":"All versions, due to potential confusion"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}