session_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 -----
Click to view modules imported as dependencies
backcall 0.2.0 cython_runtime NA dateutil 2.8.1 decorator 5.0.7 ipykernel 5.5.3 ipython_genutils 0.2.0 jedi 0.18.0 numpy 1.20.2 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 prompt_toolkit 3.0.18 ptyprocess 0.7.0 pygments 2.8.1 pytz 2021.1 six 1.15.0 storemagic NA tornado 6.1 traitlets 5.0.5 wcwidth 0.2.5 zmq 22.0.3
----- 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
If you prefer to show the session information without the HTML tags,
you can use session_info.show(html=False) in the notebook
to get the same output as in the first example above.
session_info can also write the module dependencies
to a requirements.txt file,
which is compatible with pip install -r /path/to/requirements.txt.
View the docstring for complete parameter information.
Background
session_info started as minor modifications of py_session, and as it grew it
became convenient to create a new package. session_info was built with the help of
information provided in stackoverflow answers and existing similar packages,
including
Metadata
Release files for session-info 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| session_info-1.0.1.tar.gz | 24.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| session_info-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.8 kB
Release files / session_info-1.0.1.tar.gz
| Download URL | session_info-1.0.1.tar.gz |
|---|---|
| Size | 24.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d71950d5a8ce7f7f7d5e86aa208c148c4e50b5440b77d5544d422b48e4f3ed41
|
|
BLAKE2b-256 checksum How to use checksums |
f5dc4a0c85aee2034be368d3ca293a563128122dde6db6e1bc9ca9ef3472c731
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / session_info-1.0.1-py3-none-any.whl
| Download URL | session_info-1.0.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
451d191e51816070b9f21a6ff3f6eb5d6015ae2738e8db63ac4e6398260a5838
|
|
BLAKE2b-256 checksum How to use checksums |
c5c4f6b7c0ec5241a2bde90c7ba1eca6ba44f8488bcedafe9072c79593015ec0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for session-info 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.