rasbt/watermark

--iversion does not work on dask

tobsecret opened this issue · 6 comments

dask's version is stored in dask._version, I imagine some other packages have a similar design - is it possible to account for that?

rasbt commented

Thanks for the note! Yes, this can (and should) be modified, indeed, to support packages that don't use the standard version attribute. For instance, the -p flag also considers .version and .version_info, which I encountered in a few packages. The same could be done for --iversion and -p should also be modified to support ._version

I am a bit busy this week but I am happy to put that onto my todo list. In the meantime, I'd happy to accept any PRs if someone likes to fix it before I get a chance :)

-p dask does work
It's just more convenient to type

%load_ext watermark
watermark -d -iv 

at the top of each notebook

rasbt commented

Oh, actually it does work with dask in my case ;). After I saw your second comment, I was thinking that you may have run --iversions before you imported dask? The --iversions flag currently only considers those packages that were imported during the session.

So, in order to use it properly, one needs to run it either at the end of a notebook or rerun it after the other cells in the notebook got executed.

screen shot 2017-08-28 at 2 55 32 pm

No, that is not the case in my notebook.
The first cell is imports, the second cell loads and calls the watermark extension.
I have dask 0.15.0 though but it seems like they also have ._version in dask 0.15.1.
And the following works:

%watermark -iv -v -w -p dask

and prints out:

seaborn     0.8.0
pandas      0.20.1
numpy       1.11.1
CPython 3.5.2
IPython 5.1.0

dask 0.15.0
watermark 1.5.0

If I leave out the -p flag:

%watermark -iv -v -w 

the following is printed however

seaborn     0.8.0
pandas      0.20.1
numpy       1.11.1
CPython 3.5.2
IPython 5.1.0
watermark 1.5.0

Sorry for wasting your time, found the issue.
I was importing from dask

from dask.distributed import Client, progress

but not importing all of dask itself.

rasbt commented

No worries, thanks for the update, and I am glad that it works now! (btw. I added a new issue to fix the ugly alignment of the version numbers)