Skip to main content

Get versions of all imported modules in current session

Project description

pyversions

Get versions of imported modules in current session: pyversions.versions()

Designed particularly to work within a Jupyter notebook.
Call this function in a cell just after all modules/functions are imported.
This function uses Python inspect module to get the caller's global namespace; it should work, if not, pass globals() as a parameter.

Installation

pip install pyversions

Or

conda install -c duartexyz pyversions

Examples

>>> import pyversions
>>> vs = pyversions.versions()

>>> from pyversions import versions
>>> versions();  # semicolon to avoid printing information twice

Help

"""
Get versions of imported modules in current session: pyversions.versions()

Parameters
----------
glbs : globals(), optional (default=None)
    Get all the imported modules from the passed globals() namespace.
show : bool, optional (default=True)
    Whether to print information about environment and imported modules.

Returns
-------
info : list of strings
    list of strings with information about the current environment and
    imported modules.

Notes
-----
Designed particularly to work within a Jupyter notebook.
Call this function in a cell just after all modules/functions are imported.
This function uses Python inspect module to get the caller's global
namespace; it should work, if not, pass globals() as a parameter.

Based on https://stackoverflow.com/questions/40428931

Examples
--------
>>> import pyversions
>>> vs = pyversions.versions()

>>> from pyversions import versions
>>> versions();  # semicolon to avoid printing information twice

[In a Jupyter notebook](https://github.com/demotu/pyversions/blob/master/docs/pyversions.ipynb)  

Version history
---------------
'0.0.1' :
    The first version

"""

How to cite this work

Here is a suggestion to cite this GitHub repository:

Duarte, M. (2020) pyversions: A Python module to get versions of imported modules in current session. GitHub repository, https://github.com/demotu/pyversions.

And a possible BibTeX entry:

@misc{Duarte2020,  
    author = {Duarte, M.},
    title = {pyversions: A Python module to get versions of imported modules in current session},  
    year = {2020},  
    publisher = {GitHub},  
    journal = {GitHub repository},  
    howpublished = {\url{https://github.com/demotu/pyversions}}  
}

License

The non-software content of this project is licensed under a Creative Commons Attribution 4.0 International License, and the software code is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyversions-0.0.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

pyversions-0.0.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pyversions-0.0.3.tar.gz.

File metadata

  • Download URL: pyversions-0.0.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for pyversions-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a04c22b3d88834a01fbc86f25068e64a2a772175c7e79cc19167ee7deaf85191
MD5 1ee1fb3c30b2e528dae458f391573d01
BLAKE2b-256 ce43a28ed76376b3531e19920109e28f0bd7e68f740e3d9f56894a385c5e0ce8

See more details on using hashes here.

File details

Details for the file pyversions-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyversions-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1.post20200323 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for pyversions-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f3dcee187029189ec5c21c52d700a57e2ab645d6587ffa74ab68d158034cbe27
MD5 bba466ff3d7c4136dad8a10f735d5e75
BLAKE2b-256 cd110c80e49733d851518e288740125ced5896ea6899acc78bb132cc0d60aa94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page