Skip to content

Deprecation warning in hbonds_autocorrel.py is always shown - warning filter uses always #5157

@spyke7

Description

@spyke7

Expected behavior

Users/Developers should be able to suppress deprecation warning raised inside MDAnalysis.analysis.hbonds.hbond_autocorrel.py when not needed.
The warning should only appear when appropriate.

Actual behavior

The module currently forces the warning to always appear, regardless of user filtering.
Thus this specific warning could not be suppressed in mdacli. Other warnings of type UserWarning are easily suppressed.

This line is :

warnings.simplefilter("always", DeprecationWarning)

Because "always" is there the warning is emitted every time the module is called, even when suppressed by the mdacli.

Here are the issue and PR related to suppressing warnings in mdacli -
ISSUE#128
PR#129

Code to reproduce the behavior

Please check the mdacli. I'm not giving any snippets of it here.

Current version of MDAnalysis

  • Which version are you using? 2.10.0
  • Which version of Python (python -V)? 3.12.9
  • Which operating system?
    Windows 11 + wsl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions