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.
pip install session-infoVerified import paths — ran on the pinned version, not inferred.
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.
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()`.
To include standard library modules in the output, call `session_info.show(std_lib=True)`.
To include not only explicitly imported modules but also their dependencies, use `session_info.show(dependencies=True)`.
To obtain plain text output in Jupyter Notebooks, use `session_info.show(html=False)`.
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.
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`.
pip install session-info
session_info.show()
import session_info
info_string = session_info.show(write_to_buffer=True)