Skip to content

Convert DeprecationWarning to FutureWarning for deprecated decorators. #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
- {pull}`416` removes `.from_annot` again.
- {pull}`417` deprecates {func}`pytask.mark.task` in favor of {func}`pytask.task`.
- {pull}`418` fixes and error and simplifies code in `dag.py`.
- {pull}`420` converts `DeprecationWarning`s to `FutureWarning`s for the deprecated
decorators.

## 0.3.2 - 2023-06-07

Expand Down
6 changes: 3 additions & 3 deletions src/_pytask/mark/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ def select_by_mark(session: Session, dag: nx.DiGraph) -> set[str]: ...
class MARK_GEN: # noqa: N801
@deprecated(
"'@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
category=DeprecationWarning,
category=FutureWarning,
stacklevel=1,
)
@staticmethod
def produces(objects: PyTree[str | Path]) -> None: ...
@deprecated(
"'@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
category=DeprecationWarning,
category=FutureWarning,
stacklevel=1,
)
@staticmethod
def depends_on(objects: PyTree[str | Path]) -> None: ...
@deprecated(
"'@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
category=DeprecationWarning,
category=FutureWarning,
stacklevel=1,
)
@staticmethod
Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/mark/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def __getattr__(self, name: str) -> MarkDecorator | Any:
if name in ("depends_on", "produces"):
warnings.warn(
_DEPRECATION_DECORATOR.format(name),
category=DeprecationWarning,
category=FutureWarning,
stacklevel=1,
)

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

Expand Down
6 changes: 3 additions & 3 deletions tests/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ def task_write_text(depends_on, produces):
capture_output=True,
check=False,
)
assert b"DeprecationWarning: '@pytask.mark.depends_on'" in result.stdout
assert b"DeprecationWarning: '@pytask.mark.produces'" in result.stdout
assert b"FutureWarning: '@pytask.mark.depends_on'" in result.stdout
assert b"FutureWarning: '@pytask.mark.produces'" in result.stdout


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