rasbt / watermark

An IPython magic extension for printing date and time stamps, version numbers, and hardware information
Other
890 stars 91 forks source link

Feature to auto-pull info of all imported packages #5

Closed rasbt closed 1 month ago

rasbt commented 9 years ago

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.

ljvmiranda921 commented 5 years ago

@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 5 years ago

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

cpoptic commented 5 years ago

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 5 years ago

Btw I forgot that we have a

%watermark -iv

E.g.,

screen shot 2019-02-21 at 12 00 57 pm
d-kleine commented 1 month ago

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

rasbt commented 1 month ago

Good catch, yes, this should be fine now.