pytask
pytask copied to clipboard
DOC: Code examples in documentation on "Capture warnings" produces errors locally
Location of the documentation
https://pytask-dev.readthedocs.io/en/v0.4.7/how_to_guides/capture_warnings.html
Documentation problem
The documentation states:
...
@pytask.mark.filterwarnings("ignore:.*:SettingWithCopyWarning")
...
which results in the following output AttributeError: module 'builtins' has no attribute 'SettingWithCopyWarning', when running pytask on the corresponding task file (pytask == 0.4.7 and pandas==2.2.1).
Suggested fix for documentation
To make the example code run, the decorator argument should be changed to:
...
@pytask.mark.filterwarnings("ignore:.*:pandas.errors.SettingWithCopyWarning")
...
Additionally, it could be nice to have one or two sentences on how to deal with custom warnings, or warnings that are imported from other packages, and how to ignore them in the pyproject.toml.
Thanks a lot, @timmens! Yes, this should be corrected.