rsmtool icon indicating copy to clipboard operation
rsmtool copied to clipboard

Consistent approach to warnings

Open aloukina opened this issue 5 years ago • 5 comments

In some parts of the code we use logger.warningwhile in other parts we used warnings. Is there any reason not use warnings everywhere?

aloukina avatar Feb 14 '20 00:02 aloukina

This is actually addressed in the Python logging HOWTO:

warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning.

logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted.

desilinguist avatar Feb 14 '20 00:02 desilinguist

We have a few inconsistencies in how we apply this. For example we raise UserWarning when computing partial correlations. Another concern I have is that on user side both types of warnings look very similar so we are training the users to ignore all warnings.

aloukina avatar Feb 14 '20 16:02 aloukina

On a related note, we should be using FutureWarning for deprecation warnings and not DeprecationWarning since that's what the Python documentation recommends and this is what scikit-learn has recently done.

desilinguist avatar Mar 10 '20 15:03 desilinguist

@aloukina this is done right?

desilinguist avatar Oct 20 '20 19:10 desilinguist

No, not throughout the code ;(

aloukina avatar Oct 20 '20 19:10 aloukina