rasbt/watermark

Feature to auto-pull info of all imported packages

rasbt opened this issue · 6 comments

rasbt commented

I think a new flag, e.g.,

--pull_pkginfo

or so could be useful to list all unique packages used in a notebook and the respective version numbers. Right now, we have

-p      --packages

which is useful to display the version numbers of a list of packages, which can be useful to limit the scope of packages that should be displayed. For example.

%watermark -p numpy,scipy
numpy 1.9.2
scipy 0.15.1

The --pull_pkginfo would preferably be run at the end of an IPython notebook so that a user don't have to worry about specifying packages "manually." It should scan an collect unique imports in the notebook and list all the packages, e.g.,

%watermark --pull_pkginfo
    numpy 1.9.2
    scipy 0.15.1
    ...

Maybe excluding packages from the standard lib since we already have a -v flag to show the Python version number.

@rasbt You thinks solution might lead the way?
https://stackoverflow.com/questions/40428931/package-for-listing-version-of-packages-used-in-a-jupyter-notebook

The idea is to pkg_resources library and pulling the packages + version numbers from that. Let me try next year and see what happens

rasbt commented

Yeah, the use of pkg_resources sounds fine to me. (Also see the related discussion at #41)

Yes this would be a valuable feature; it certainly beats having to manually specifying each package. Often the user just wants the version of all packages imported in the Jupyter notebook.

rasbt commented

Btw I forgot that we have a

%watermark -iv

E.g.,

screen shot 2019-02-21 at 12 00 57 pm

issue should be closed imho, as %watermark -iv lists all imported pkgs with name and version

Good catch, yes, this should be fine now.