Skip to content

Commit 3a1df52

Browse files
authored
Convert DeprecationWarning to FutureWarning for deprecated decorators. (#420)
1 parent 262d6e7 commit 3a1df52

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Diff for: docs/source/changes.md

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
3636
- {pull}`416` removes `.from_annot` again.
3737
- {pull}`417` deprecates {func}`pytask.mark.task` in favor of {func}`pytask.task`.
3838
- {pull}`418` fixes and error and simplifies code in `dag.py`.
39+
- {pull}`420` converts `DeprecationWarning`s to `FutureWarning`s for the deprecated
40+
decorators.
3941

4042
## 0.3.2 - 2023-06-07
4143

Diff for: src/_pytask/mark/__init__.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ def select_by_mark(session: Session, dag: nx.DiGraph) -> set[str]: ...
1717
class MARK_GEN: # noqa: N801
1818
@deprecated(
1919
"'@pytask.mark.produces' is deprecated starting pytask v0.4.0 and will be removed in v0.5.0. To upgrade your project to the new syntax, read the tutorial on product and dependencies: https://tinyurl.com/yrezszr4.", # noqa: E501, PYI053
20-
category=DeprecationWarning,
20+
category=FutureWarning,
2121
stacklevel=1,
2222
)
2323
@staticmethod
2424
def produces(objects: PyTree[str | Path]) -> None: ...
2525
@deprecated(
2626
"'@pytask.mark.depends_on' is deprecated starting pytask v0.4.0 and will be removed in v0.5.0. To upgrade your project to the new syntax, read the tutorial on product and dependencies: https://tinyurl.com/yrezszr4.", # noqa: E501, PYI053
27-
category=DeprecationWarning,
27+
category=FutureWarning,
2828
stacklevel=1,
2929
)
3030
@staticmethod
3131
def depends_on(objects: PyTree[str | Path]) -> None: ...
3232
@deprecated(
3333
"'@pytask.mark.task' is deprecated starting pytask v0.4.0 and will be removed in v0.5.0. Use '@pytask.task' instead.", # noqa: E501, PYI053
34-
category=DeprecationWarning,
34+
category=FutureWarning,
3535
stacklevel=1,
3636
)
3737
@staticmethod

Diff for: src/_pytask/mark/structures.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def __getattr__(self, name: str) -> MarkDecorator | Any:
202202
if name in ("depends_on", "produces"):
203203
warnings.warn(
204204
_DEPRECATION_DECORATOR.format(name),
205-
category=DeprecationWarning,
205+
category=FutureWarning,
206206
stacklevel=1,
207207
)
208208

@@ -233,7 +233,7 @@ def __getattr__(self, name: str) -> MarkDecorator | Any:
233233
warnings.warn(
234234
"'@pytask.mark.task' is deprecated starting pytask v0.4.0 and will be "
235235
"removed in v0.5.0. Use '@pytask.task' instead.",
236-
category=DeprecationWarning,
236+
category=FutureWarning,
237237
stacklevel=1,
238238
)
239239

Diff for: tests/test_mark.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ def task_write_text(depends_on, produces):
375375
capture_output=True,
376376
check=False,
377377
)
378-
assert b"DeprecationWarning: '@pytask.mark.depends_on'" in result.stdout
379-
assert b"DeprecationWarning: '@pytask.mark.produces'" in result.stdout
378+
assert b"FutureWarning: '@pytask.mark.depends_on'" in result.stdout
379+
assert b"FutureWarning: '@pytask.mark.produces'" in result.stdout
380380

381381

382382
@pytest.mark.end_to_end()
@@ -394,4 +394,4 @@ def task_write_text(): ...
394394
capture_output=True,
395395
check=False,
396396
)
397-
assert b"DeprecationWarning: '@pytask.mark.task'" in result.stdout
397+
assert b"FutureWarning: '@pytask.mark.task'" in result.stdout

0 commit comments

Comments
 (0)