Skip to content

DOC: Code examples in documentation on "Capture warnings" produces errors locally  #583

@timmens

Description

@timmens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions