Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annoying UserWarnings #33

Open
Devligue opened this issue May 4, 2020 · 4 comments
Open

Annoying UserWarnings #33

Devligue opened this issue May 4, 2020 · 4 comments

Comments

@Devligue
Copy link

Devligue commented May 4, 2020

Hi, would it be possible to make the user warnings display only when using pipes that actually depend on these imports? Or at least display them in a way that allows filtering out (with logging package perhaps)?

It's just a minor flaw on otherwise great package. Awesome work!

@shaypal5
Copy link
Collaborator

shaypal5 commented May 5, 2020

Hmmm. I'm not sure.

I think it means moving all imports into function calls, instead of the module containing the class that defines the pipeline stage; then, dependencies should be imported on function calls instead of on class imports from the module (which happen right when you import pdpipe).

A bit of work, I guess, but not impossible.

If you want to fork and create a branch when you try to do this for one of the modules (I'd go for the nltk one, so then you can see if you successfully eliminate all warnings on nltk while still passing all the tests), go ahead and I'll help out as much as I can.

@Devligue
Copy link
Author

Wouldn't it be simpler to just include scikit-learn and nltk as regular requirements instead of making them optional? Alternatively, the stages that require these packages could be separated as "plugins" to the main pdpipe package. I don't mean to criticise the architectural decisions but the current solution feels kind of strange to me.

One other approach I could think of, perhaps a compromise between all of the above, would be to use logging module for the warnings so that they can be easily silenced, for example in production envs where they are polluting quite a bit.

What do you think @shaypal5?

@Devligue
Copy link
Author

Devligue commented Jun 12, 2020

Just to share a temporary workaround for anyone interested. What I currently do is:

import warnings

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    import pdpipe as pdp

@shaypal5
Copy link
Collaborator

A year later, during spring cleaning, just popping over to write that I don't think scikit-learn and nltk should be mandatory requirements. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants