@@ -24,14 +24,27 @@ def task_warning(produces):
24
24
Running pytask produces
25
25
26
26
``` {image} /_static/images/warning.svg
27
+
27
28
```
28
29
29
30
## Controlling warnings
30
31
31
- You can use the ` filterwarnings ` option in ` pyproject.toml ` to configure pytasks
32
- behavior to warnings. For example, the configuration below will ignore all user warnings
33
- and specific deprecation warnings matching a regex, but will transform all other
34
- warnings into errors.
32
+ You can use the ` filterwarnings ` option in ` pyproject.toml ` to configure pytask's
33
+ behavior when it comes to warnings.
34
+
35
+ The syntax for specifying warnings filters is the same as in the
36
+ [ Python standard library] ( https://docs.python.org/3/library/warnings.html#the-warnings-filter ) ,
37
+ i.e., a sequence of fields separated by colons:
38
+
39
+ ```
40
+ action:message:category:module:line
41
+ ```
42
+
43
+ You can specify a list of such filters. When a warning matches more than one option, the
44
+ action for the last matching option is performed.
45
+
46
+ For example, the configuration below will ignore specific deprecation warnings matching
47
+ a regex, all user warnings, and transform all other warnings into errors.
35
48
36
49
``` toml
37
50
[tool .pytask .ini_options ]
@@ -43,8 +56,10 @@ filterwarnings = [
43
56
]
44
57
```
45
58
46
- When a warning matches more than one option in the list, the action for the last
47
- matching option is performed.
59
+ The syntax is explained in more detail in
60
+ [ this section] ( https://docs.python.org/3/library/warnings.html#the-warnings-filter ) of
61
+ the Python documentation and there are also
62
+ [ more examples] ( https://docs.python.org/3/library/warnings.html#describing-warning-filters ) .
48
63
49
64
## ` @pytask.mark.filterwarnings `
50
65
0 commit comments