rasbt/watermark

Watermark doesn't catch classes/functions imported using `from`

matrs opened this issue · 5 comments

matrs commented

Hello,
first, thank you for this package.
I just noticed this behaviour when importing a subclass from Biopython:

from Bio import SeqIO

the watermark magic doesn't show the info of the imported package (Bio). I'm aware that I can solve this doing

import Bio

but i was wondering if it could be implemented given that for many libraries It is customary to use:

from X import Y

Cheers!

rasbt commented

Hi there,

could you show your usage example? I am wondering because there is currently no feature to print all the imported packages automatically (we may add that at some point though, as mentioned in #5)

So in order to show the package version, you would execute

%watermark -p Bio
matrs commented

Sorry, I wasn't clear enough.
I'm using %watermark -iv to print the version of all imported modules.
So when I use

from Bio import SeqIO

%watermark -iv doesn't print any information about the module Bio, as if It wasn't imported. Of course, it works if I use

import Bio

I was expecting that %watermark -iv printed information about Bio despite the way I imported it because the Bio module it's actually being imported in both cases. So this is a particular example of the general case where any submodule/class/function is imported using

from X import Y

and %watermark -iv doesn't print any information for X (or Y if you prefer that).

could you show your usage example? I am wondering because there is currently no feature to print all the imported packages automatically

But in the help says:
-iv, --iversions prints the name/version of all imported modules

rasbt commented

Oh sorry, I was confused and forgot that we already added the -iv flag ... for some reason, I thought this was still work in progress.

I agree with you that it would be super nice to support the from X import Y scenarios. And I think this is an easy fix. I think I can just implement it right-away in a few minutes

rasbt commented

That functionality should work in the the new 1.8.0 version now :)

matrs commented

Thank you , that was fast!