session_info outputs version information for modules loaded in the current session, Python, and the OS.
Low maintenance activity. Last release 20 months ago. Weaker on commit activity and recent releases.
Consider insteadsession-info2Pythie’s Index: 781.6M downloads/moCompare →
pip install session-infosession_info
session_info outputs version information for modules loaded in the current session,
Python, the OS, and the CPU. It is designed as a minimum measure to increase
reproducibility and provides similar information as sessionInfo and
devtools::session_info in R.
Motivation
session_info is particularly useful when conducting exploratory data analysis in
Jupyter notebooks. Listing the version numbers of all loaded modules after
importing them is a simple way to ensure a minimum level of reproducibility
while requiring little additional effort. This practice is useful both when
revisiting notebooks and when sharing them with colleagues. session_info is meant to
complement more robust practices such as frozen virtual environments,
containers, and binder.
Installation
session_info can be installed via pip install session-info or conda install -c conda-forge session-info.
It does not depend on a package manager to find version numbers
since it fetches them from the module's version string.
Its only dependency is stdlib_list, which is used to distinguish
between standard library and third party modules.
Usage
session_info can be used from a script like so:
import math
import natsort
import pandas
import session_info
session_info.show()
Output:
Session information:
-----
natsort 7.1.1
pandas 1.2.2
session_info 1.0.0
-----
IPython 7.23.0
jupyter_client 6.1.12
jupyter_core 4.7.1
-----
Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:46) [GCC 9.3.0]
Linux-5.11.13-arch1-1-x86_64-with-glibc2.33
-----
Session information updated at 2021-05-06 09:59
The default behavior is to only output modules not in the standard library,
which is why the math module is omitted above (it can be included by
specifying std_lib=True). To include not only the explicitly imported
modules, but also any dependencies they import internally, specify dependencies=True.
When session_info is invoked from a Jupyter Notebook,
the output is concealed in <details> tags
and will only show when clicked.
Since this saves visual real estate,
any modules imported indirectly as dependencies
will be included by default
and it looks like this:
Click to view session information
----- natsort 7.1.1 pandas 1.2.2 session_info 1.0.0 -----