diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64626aa7..026a3f29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,18 +24,6 @@ repos: - id: python-check-mock-methods - id: python-no-log-warn - id: text-unicode-replacement-char -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 - hooks: - - id: reorder-python-imports - args: [--py38-plus, --add-import, 'from __future__ import annotations'] - exclude: ^(docs_src/) -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 - hooks: - - id: reorder-python-imports - args: [--py38-plus] - files: ^(docs_src/) # - repo: https://github.com/tox-dev/pyproject-fmt # rev: 1.2.0 # hooks: @@ -45,7 +33,7 @@ repos: hooks: - id: sort-all - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.3.1 hooks: - id: ruff-format - id: ruff @@ -90,7 +78,7 @@ repos: ] files: (docs/.) - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.1 + rev: 1.8.4 hooks: - id: nbqa-black - id: nbqa-isort diff --git a/docs/source/conf.py b/docs/source/conf.py index ab2c0ef0..84b0d6be 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -4,6 +4,7 @@ documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html """ + from __future__ import annotations import inspect diff --git a/docs/source/tutorials/making_tasks_persist.md b/docs/source/tutorials/making_tasks_persist.md index baa3d5e8..ae1e1636 100644 --- a/docs/source/tutorials/making_tasks_persist.md +++ b/docs/source/tutorials/making_tasks_persist.md @@ -13,7 +13,7 @@ in the database such that the subsequent execution will skip the task successful ## When is this useful? -- You ran a formatter like Black on the files in your project and want to prevent the +- You ran a formatter like ruff on the files in your project and want to prevent the longest-running tasks from being rerun. - You extend a repetition of a task function but do not want to rerun all tasks. - You want to integrate a task that you have already run elsewhere. Copy over the diff --git a/docs/source/tutorials/repeating_tasks_with_different_inputs.md b/docs/source/tutorials/repeating_tasks_with_different_inputs.md index b369167b..750435d6 100644 --- a/docs/source/tutorials/repeating_tasks_with_different_inputs.md +++ b/docs/source/tutorials/repeating_tasks_with_different_inputs.md @@ -93,17 +93,17 @@ auto-generated ids are used. ### Auto-generated ids -pytask construct ids by extending the task name with representations of the values used +pytask constructs ids by extending the task name with representations of the values used for each iteration. Booleans, floats, integers, and strings enter the task id directly. For example, a task function that receives four arguments, `True`, `1.0`, `2`, and -`"hello"`, one of each dtype, has the following id. +`"hello"`, one of each data type, has the following id. ``` task_data_preparation.py::task_create_random_data[True-1.0-2-hello] ``` -Arguments with other dtypes cannot be converted to strings and, thus, are replaced with -a combination of the argument name and the iteration counter. +Arguments with other data types cannot be converted to strings and, thus, are replaced +with a combination of the argument name and the iteration counter. For example, the following function is parametrized with tuples. @@ -136,7 +136,7 @@ For example, the following function is parametrized with tuples. Since the tuples are not converted to strings, the ids of the two tasks are -``` +```text task_data_preparation.py::task_create_random_data[seed0] task_data_preparation.py::task_create_random_data[seed1] ``` @@ -177,7 +177,7 @@ a unique name for the iteration. produces these ids -``` +```text task_data_preparation.py::task_create_random_data[first] task_data_preparation.py::task_create_random_data[second] ``` diff --git a/docs/source/tutorials/using_a_data_catalog.md b/docs/source/tutorials/using_a_data_catalog.md index b3b31267..d704421d 100644 --- a/docs/source/tutorials/using_a_data_catalog.md +++ b/docs/source/tutorials/using_a_data_catalog.md @@ -61,7 +61,7 @@ The following tabs show you how to use the data catalog given the interface you ````{tab-item} Python 3.10+ :sync: python310plus -Use `data_catalog["key"]` as an default argument to access the +Use `data_catalog["data"]` as an default argument to access the {class}`~pytask.PickleNode` within the task. When you are done transforming your {class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`. @@ -74,7 +74,7 @@ Use `data_catalog["key"]` as an default argument to access the ````{tab-item} Python 3.8+ :sync: python38plus -Use `data_catalog["key"]` as an default argument to access the +Use `data_catalog["data"]` as an default argument to access the {class}`~pytask.PickleNode` within the task. When you are done transforming your {class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`. @@ -87,7 +87,7 @@ Use `data_catalog["key"]` as an default argument to access the ````{tab-item} ​produces :sync: produces -Use `data_catalog["key"]` as an default argument to access the +Use `data_catalog["data"]` as an default argument to access the {class}`~pytask.PickleNode` within the task. When you are done transforming your {class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`. @@ -125,7 +125,7 @@ Following one of the interfaces gives you immediate access to the ````{tab-item} Python 3.10+ :sync: python310plus -Use `data_catalog["key"]` as an default argument to access the +Use `data_catalog["data"]` as an default argument to access the {class}`~pytask.PickleNode` within the task. When you are done transforming your {class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`. @@ -138,7 +138,7 @@ Use `data_catalog["key"]` as an default argument to access the ````{tab-item} Python 3.8+ :sync: python38plus -Use `data_catalog["key"]` as an default argument to access the +Use `data_catalog["data"]` as an default argument to access the {class}`~pytask.PickleNode` within the task. When you are done transforming your {class}`~pandas.DataFrame`, save it with {meth}`~pytask.PickleNode.save`. diff --git a/docs_src/how_to_guides/bp_scaling_tasks_1.py b/docs_src/how_to_guides/bp_scaling_tasks_1.py index 5479b678..52d6ea61 100644 --- a/docs_src/how_to_guides/bp_scaling_tasks_1.py +++ b/docs_src/how_to_guides/bp_scaling_tasks_1.py @@ -4,7 +4,6 @@ from my_project.config import BLD from my_project.config import SRC - DATA = { "data_0": {"subset": "subset_1"}, "data_1": {"subset": "subset_2"}, diff --git a/docs_src/how_to_guides/bp_scaling_tasks_3.py b/docs_src/how_to_guides/bp_scaling_tasks_3.py index 1f592f56..1e2103d4 100644 --- a/docs_src/how_to_guides/bp_scaling_tasks_3.py +++ b/docs_src/how_to_guides/bp_scaling_tasks_3.py @@ -4,7 +4,6 @@ from my_project.config import BLD from my_project.data_preparation.config import DATA - _MODELS = ["linear_probability", "logistic_model", "decision_tree"] diff --git a/docs_src/how_to_guides/bp_structure_of_task_files.py b/docs_src/how_to_guides/bp_structure_of_task_files.py index 19ab8e7b..dcd7e679 100644 --- a/docs_src/how_to_guides/bp_structure_of_task_files.py +++ b/docs_src/how_to_guides/bp_structure_of_task_files.py @@ -26,9 +26,7 @@ def task_prepare_census_data( df.to_pickle(path_to_census) -def _clean_data(df: pd.DataFrame) -> None: - ... +def _clean_data(df: pd.DataFrame) -> None: ... -def _create_new_variables(df: pd.DataFrame) -> None: - ... +def _create_new_variables(df: pd.DataFrame) -> None: ... diff --git a/docs_src/how_to_guides/interfaces/dependencies_annotation.py b/docs_src/how_to_guides/interfaces/dependencies_annotation.py index 9e8aeb6f..1c30c068 100644 --- a/docs_src/how_to_guides/interfaces/dependencies_annotation.py +++ b/docs_src/how_to_guides/interfaces/dependencies_annotation.py @@ -4,5 +4,4 @@ from pytask import PathNode -def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None: - ... +def task_example(path: Annotated[Path, PathNode(path=Path("input.txt"))]) -> None: ... diff --git a/docs_src/how_to_guides/interfaces/dependencies_default.py b/docs_src/how_to_guides/interfaces/dependencies_default.py index 50c8c5b5..e2b0ff69 100644 --- a/docs_src/how_to_guides/interfaces/dependencies_default.py +++ b/docs_src/how_to_guides/interfaces/dependencies_default.py @@ -1,5 +1,4 @@ from pathlib import Path -def task_example(path: Path = Path("input.txt")) -> None: - ... +def task_example(path: Path = Path("input.txt")) -> None: ... diff --git a/docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py b/docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py index 25cd8fda..03ee8df3 100644 --- a/docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py +++ b/docs_src/how_to_guides/interfaces/dependencies_task_kwargs.py @@ -4,5 +4,4 @@ @task(kwargs={"path": Path("input.txt")}) -def task_example(path: Path) -> None: - ... +def task_example(path: Path) -> None: ... diff --git a/docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py b/docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py index a656e42f..6c92c172 100644 --- a/docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py +++ b/docs_src/how_to_guides/migrating_from_scripts_to_pytask_1.py @@ -1,7 +1,6 @@ # Content of task_data_management.py import pandas as pd - df = pd.read_csv("data.csv") # Many operations. diff --git a/docs_src/how_to_guides/remote_files/https.py b/docs_src/how_to_guides/remote_files/https.py index a284fce1..8dc94a3c 100644 --- a/docs_src/how_to_guides/remote_files/https.py +++ b/docs_src/how_to_guides/remote_files/https.py @@ -3,7 +3,6 @@ from upath import UPath - url = UPath("https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data") diff --git a/docs_src/how_to_guides/using_task_returns_example_2_task.py b/docs_src/how_to_guides/using_task_returns_example_2_task.py index f4f99bca..8c9ec96d 100644 --- a/docs_src/how_to_guides/using_task_returns_example_2_task.py +++ b/docs_src/how_to_guides/using_task_returns_example_2_task.py @@ -2,7 +2,6 @@ from pytask import task - func = lambda *x: "This is the content of the text file." diff --git a/docs_src/how_to_guides/using_task_returns_example_3_task.py b/docs_src/how_to_guides/using_task_returns_example_3_task.py index f76c97fe..49f68a30 100644 --- a/docs_src/how_to_guides/using_task_returns_example_3_task.py +++ b/docs_src/how_to_guides/using_task_returns_example_3_task.py @@ -2,7 +2,6 @@ from pytask import task - func = lambda *x: "This is the first content.", "This is the second content." diff --git a/docs_src/how_to_guides/using_task_returns_example_4_py310.py b/docs_src/how_to_guides/using_task_returns_example_4_py310.py index 1ed1e6f7..f4250cf1 100644 --- a/docs_src/how_to_guides/using_task_returns_example_4_py310.py +++ b/docs_src/how_to_guides/using_task_returns_example_4_py310.py @@ -3,7 +3,6 @@ from pytask import PythonNode - nodes = [ {"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")}, (PythonNode(name="tuple1"), PythonNode(name="tuple2")), diff --git a/docs_src/how_to_guides/using_task_returns_example_4_py38.py b/docs_src/how_to_guides/using_task_returns_example_4_py38.py index 09c63920..fd548050 100644 --- a/docs_src/how_to_guides/using_task_returns_example_4_py38.py +++ b/docs_src/how_to_guides/using_task_returns_example_4_py38.py @@ -3,7 +3,6 @@ from pytask import PythonNode from typing_extensions import Annotated - nodes = [ {"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")}, (PythonNode(name="tuple1"), PythonNode(name="tuple2")), diff --git a/docs_src/how_to_guides/using_task_returns_example_4_task.py b/docs_src/how_to_guides/using_task_returns_example_4_task.py index 21edae65..f8f5bace 100644 --- a/docs_src/how_to_guides/using_task_returns_example_4_task.py +++ b/docs_src/how_to_guides/using_task_returns_example_4_task.py @@ -1,7 +1,6 @@ from pytask import PythonNode from pytask import task - nodes = [ {"first": PythonNode(name="dict1"), "second": PythonNode(name="dict2")}, (PythonNode(name="tuple1"), PythonNode(name="tuple2")), diff --git a/docs_src/how_to_guides/writing_custom_nodes_example_2_py310.py b/docs_src/how_to_guides/writing_custom_nodes_example_2_py310.py index 0a836647..70ab2114 100644 --- a/docs_src/how_to_guides/writing_custom_nodes_example_2_py310.py +++ b/docs_src/how_to_guides/writing_custom_nodes_example_2_py310.py @@ -5,8 +5,7 @@ from pytask import Product -class PickleNode: - ... +class PickleNode: ... in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl") diff --git a/docs_src/how_to_guides/writing_custom_nodes_example_2_py310_return.py b/docs_src/how_to_guides/writing_custom_nodes_example_2_py310_return.py index e8f39a0c..33315cfa 100644 --- a/docs_src/how_to_guides/writing_custom_nodes_example_2_py310_return.py +++ b/docs_src/how_to_guides/writing_custom_nodes_example_2_py310_return.py @@ -4,8 +4,7 @@ import pandas as pd -class PickleNode: - ... +class PickleNode: ... in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl") diff --git a/docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py b/docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py index 37f5bc59..5125139e 100644 --- a/docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py +++ b/docs_src/how_to_guides/writing_custom_nodes_example_2_py38.py @@ -5,8 +5,7 @@ from typing_extensions import Annotated -class PickleNode: - ... +class PickleNode: ... in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl") diff --git a/docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py b/docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py index 3555f7ff..8a93d5f6 100644 --- a/docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py +++ b/docs_src/how_to_guides/writing_custom_nodes_example_2_py38_return.py @@ -4,8 +4,7 @@ from typing_extensions import Annotated -class PickleNode: - ... +class PickleNode: ... in_node = PickleNode.from_path(Path(__file__).parent / "in.pkl") diff --git a/docs_src/tutorials/defining_dependencies_products_multiple1_produces.py b/docs_src/tutorials/defining_dependencies_products_multiple1_produces.py index faa83211..05313df1 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple1_produces.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple1_produces.py @@ -3,7 +3,6 @@ from my_project.config import BLD - _PRODUCTS = {"first": BLD / "data_0.pkl", "second": BLD / "data_1.pkl"} @@ -11,5 +10,4 @@ def task_plot_data( path_to_data_0: Path = BLD / "data_0.pkl", path_to_data_1: Path = BLD / "data_1.pkl", produces: Dict[str, Path] = _PRODUCTS, -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_multiple1_py310.py b/docs_src/tutorials/defining_dependencies_products_multiple1_py310.py index 78836e9d..91bb9574 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple1_py310.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple1_py310.py @@ -10,5 +10,4 @@ def task_plot_data( path_to_data_1: Path = BLD / "data_1.pkl", path_to_plot_0: Annotated[Path, Product] = BLD / "plot_0.png", path_to_plot_1: Annotated[Path, Product] = BLD / "plot_1.png", -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_multiple1_py38.py b/docs_src/tutorials/defining_dependencies_products_multiple1_py38.py index c2b08824..b7367c5b 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple1_py38.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple1_py38.py @@ -10,5 +10,4 @@ def task_plot_data( path_to_data_1: Path = BLD / "data_1.pkl", path_to_plot_0: Annotated[Path, Product] = BLD / "plot_0.png", path_to_plot_1: Annotated[Path, Product] = BLD / "plot_1.png", -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_multiple2_produces.py b/docs_src/tutorials/defining_dependencies_products_multiple2_produces.py index bf2c4463..09968a1e 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple2_produces.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple2_produces.py @@ -15,5 +15,4 @@ def task_plot_data( path_to_data: dict[str, Path] = _DEPENDENCIES, produces: dict[str, Path] = _PRODUCTS, -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_multiple2_py310.py b/docs_src/tutorials/defining_dependencies_products_multiple2_py310.py index 3918ef41..fa6a64f7 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple2_py310.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple2_py310.py @@ -4,7 +4,6 @@ from my_project.config import BLD from pytask import Product - _DEPENDENCIES = {"data_0": BLD / "data_0.pkl", "data_1": BLD / "data_1.pkl"} _PRODUCTS = {"plot_0": BLD / "plot_0.png", "plot_1": BLD / "plot_1.png"} @@ -12,5 +11,4 @@ def task_plot_data( path_to_data: dict[str, Path] = _DEPENDENCIES, path_to_plots: Annotated[dict[str, Path], Product] = _PRODUCTS, -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_multiple2_py38.py b/docs_src/tutorials/defining_dependencies_products_multiple2_py38.py index 37ccb765..5759e49e 100644 --- a/docs_src/tutorials/defining_dependencies_products_multiple2_py38.py +++ b/docs_src/tutorials/defining_dependencies_products_multiple2_py38.py @@ -5,7 +5,6 @@ from pytask import Product from typing_extensions import Annotated - _DEPENDENCIES = {"data_0": BLD / "data_0.pkl", "data_1": BLD / "data_1.pkl"} _PRODUCTS = {"plot_0": BLD / "plot_0.png", "plot_1": BLD / "plot_1.png"} @@ -13,5 +12,4 @@ def task_plot_data( path_to_data: Dict[str, Path] = _DEPENDENCIES, path_to_plots: Annotated[Dict[str, Path], Product] = _PRODUCTS, -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_relative_produces.py b/docs_src/tutorials/defining_dependencies_products_relative_produces.py index b3c2e2ea..7dd568f0 100644 --- a/docs_src/tutorials/defining_dependencies_products_relative_produces.py +++ b/docs_src/tutorials/defining_dependencies_products_relative_produces.py @@ -1,5 +1,4 @@ from pathlib import Path -def task_create_random_data(produces: Path = Path("../bld/data.pkl")) -> None: - ... +def task_create_random_data(produces: Path = Path("../bld/data.pkl")) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_relative_py310.py b/docs_src/tutorials/defining_dependencies_products_relative_py310.py index 7b110464..731586b0 100644 --- a/docs_src/tutorials/defining_dependencies_products_relative_py310.py +++ b/docs_src/tutorials/defining_dependencies_products_relative_py310.py @@ -6,5 +6,4 @@ def task_create_random_data( path_to_data: Annotated[Path, Product] = Path("../bld/data.pkl"), -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/defining_dependencies_products_relative_py38.py b/docs_src/tutorials/defining_dependencies_products_relative_py38.py index 174269a7..664c37b3 100644 --- a/docs_src/tutorials/defining_dependencies_products_relative_py38.py +++ b/docs_src/tutorials/defining_dependencies_products_relative_py38.py @@ -6,5 +6,4 @@ def task_create_random_data( path_to_data: Annotated[Path, Product] = Path("../bld/data.pkl"), -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs1_produces.py b/docs_src/tutorials/repeating_tasks_with_different_inputs1_produces.py index e8502461..af26893e 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs1_produces.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs1_produces.py @@ -2,11 +2,9 @@ from pytask import task - for seed in range(10): @task def task_create_random_data( produces: Path = Path(f"data_{seed}.pkl"), seed: int = seed - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs1_py310.py b/docs_src/tutorials/repeating_tasks_with_different_inputs1_py310.py index 43df51b3..7d43d06a 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs1_py310.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs1_py310.py @@ -4,11 +4,9 @@ from pytask import Product from pytask import task - for seed in range(10): @task def task_create_random_data( path: Annotated[Path, Product] = Path(f"data_{seed}.pkl"), seed: int = seed - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py b/docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py index bb7b76fb..37936ea2 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs1_py38.py @@ -4,11 +4,9 @@ from pytask import task from typing_extensions import Annotated - for seed in range(10): @task def task_create_random_data( path: Annotated[Path, Product] = Path(f"data_{seed}.pkl"), seed: int = seed - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs2_produces.py b/docs_src/tutorials/repeating_tasks_with_different_inputs2_produces.py index b06d5d2d..ca62032d 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs2_produces.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs2_produces.py @@ -3,7 +3,6 @@ from my_project.config import SRC from pytask import task - for seed in range(10): @task @@ -11,5 +10,4 @@ def task_create_random_data( path_to_parameters: Path = SRC / "parameters.yml", produces: Path = Path(f"data_{seed}.pkl"), seed: int = seed, - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs2_py310.py b/docs_src/tutorials/repeating_tasks_with_different_inputs2_py310.py index db8d2994..aa2747dd 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs2_py310.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs2_py310.py @@ -5,7 +5,6 @@ from pytask import Product from pytask import task - for seed in range(10): @task @@ -13,5 +12,4 @@ def task_create_random_data( path_to_parameters: Path = SRC / "parameters.yml", path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.pkl"), seed: int = seed, - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py b/docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py index d2f4ae72..8e6ee015 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs2_py38.py @@ -5,7 +5,6 @@ from pytask import task from typing_extensions import Annotated - for seed in range(10): @task @@ -13,5 +12,4 @@ def task_create_random_data( path_to_parameters: Path = SRC / "parameters.yml", path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.pkl"), seed: int = seed, - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs3_produces.py b/docs_src/tutorials/repeating_tasks_with_different_inputs3_produces.py index e42a1496..05762602 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs3_produces.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs3_produces.py @@ -3,11 +3,9 @@ from pytask import task - for seed in ((0,), (1,)): @task def task_create_random_data( produces: Path = Path(f"data_{seed[0]}.pkl"), seed: Tuple[int] = seed - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs3_py310.py b/docs_src/tutorials/repeating_tasks_with_different_inputs3_py310.py index ef7b9d27..a3fe36b6 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs3_py310.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs3_py310.py @@ -4,12 +4,10 @@ from pytask import Product from pytask import task - for seed in ((0,), (1,)): @task def task_create_random_data( seed: tuple[int] = seed, path_to_data: Annotated[Path, Product] = Path(f"data_{seed[0]}.pkl"), - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs3_py38.py b/docs_src/tutorials/repeating_tasks_with_different_inputs3_py38.py index 94c1d448..a0d0d2fe 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs3_py38.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs3_py38.py @@ -5,12 +5,10 @@ from pytask import task from typing_extensions import Annotated - for seed in ((0,), (1,)): @task def task_create_random_data( seed: Tuple[int] = seed, path_to_data: Annotated[Path, Product] = Path(f"data_{seed[0]}.pkl"), - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs4_produces.py b/docs_src/tutorials/repeating_tasks_with_different_inputs4_produces.py index f6fc8bc8..d8ae0532 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs4_produces.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs4_produces.py @@ -2,11 +2,9 @@ from pytask import task - for seed, id_ in ((0, "first"), (1, "second")): @task(id=id_) def task_create_random_data( produces: Path = Path(f"out_{seed}.txt"), seed: int = seed - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs4_py310.py b/docs_src/tutorials/repeating_tasks_with_different_inputs4_py310.py index d26a3572..b878a07c 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs4_py310.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs4_py310.py @@ -4,12 +4,10 @@ from pytask import Product from pytask import task - for seed, id_ in ((0, "first"), (1, "second")): @task(id=id_) def task_create_random_data( seed: int = seed, path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.txt"), - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs4_py38.py b/docs_src/tutorials/repeating_tasks_with_different_inputs4_py38.py index 67b7c654..9f6ba694 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs4_py38.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs4_py38.py @@ -4,12 +4,10 @@ from pytask import task from typing_extensions import Annotated - for seed, id_ in ((0, "first"), (1, "second")): @task(id=id_) def task_create_random_data( seed: int = seed, path_to_data: Annotated[Path, Product] = Path(f"data_{seed}.txt"), - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs5_produces.py b/docs_src/tutorials/repeating_tasks_with_different_inputs5_produces.py index 33091f59..a2956514 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs5_produces.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs5_produces.py @@ -18,5 +18,4 @@ class _Arguments(NamedTuple): for id_, kwargs in ID_TO_KWARGS.items(): @task(id=id_, kwargs=kwargs) - def task_create_random_data(seed: int, produces: Path) -> None: - ... + def task_create_random_data(seed: int, produces: Path) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs5_py310.py b/docs_src/tutorials/repeating_tasks_with_different_inputs5_py310.py index 325d42e2..13fea375 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs5_py310.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs5_py310.py @@ -22,5 +22,4 @@ class _Arguments(NamedTuple): @task(id=id_, kwargs=kwargs) def task_create_random_data( seed: int, path_to_data: Annotated[Path, Product] - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/repeating_tasks_with_different_inputs5_py38.py b/docs_src/tutorials/repeating_tasks_with_different_inputs5_py38.py index cf255d53..6d661a57 100644 --- a/docs_src/tutorials/repeating_tasks_with_different_inputs5_py38.py +++ b/docs_src/tutorials/repeating_tasks_with_different_inputs5_py38.py @@ -22,5 +22,4 @@ class _Arguments(NamedTuple): @task(id=id_, kwargs=kwargs) def task_create_random_data( seed: int, path_to_data: Annotated[Path, Product] - ) -> None: - ... + ) -> None: ... diff --git a/docs_src/tutorials/skipping_tasks_example_1.py b/docs_src/tutorials/skipping_tasks_example_1.py index a9e50742..73fb9b93 100644 --- a/docs_src/tutorials/skipping_tasks_example_1.py +++ b/docs_src/tutorials/skipping_tasks_example_1.py @@ -8,5 +8,4 @@ @pytask.mark.skip() def task_long_running( path: Annotated[Path, Product] = Path("time_intensive_product.pkl"), -) -> None: - ... +) -> None: ... diff --git a/docs_src/tutorials/using_a_data_catalog_1.py b/docs_src/tutorials/using_a_data_catalog_1.py index bbe5838b..6823bcba 100644 --- a/docs_src/tutorials/using_a_data_catalog_1.py +++ b/docs_src/tutorials/using_a_data_catalog_1.py @@ -2,7 +2,6 @@ from pytask import DataCatalog - SRC = Path(__file__).parent.resolve() BLD = SRC.joinpath("..", "..", "bld").resolve() diff --git a/docs_src/tutorials/using_a_data_catalog_2_produces.py b/docs_src/tutorials/using_a_data_catalog_2_produces.py index 77a082fb..6bafacdf 100644 --- a/docs_src/tutorials/using_a_data_catalog_2_produces.py +++ b/docs_src/tutorials/using_a_data_catalog_2_produces.py @@ -1,7 +1,7 @@ import numpy as np import pandas as pd -from my_project.config import data_catalog from my_project.config import PickleNode +from my_project.config import data_catalog def task_create_random_data(produces: PickleNode = data_catalog["data"]) -> None: diff --git a/docs_src/tutorials/using_a_data_catalog_4.py b/docs_src/tutorials/using_a_data_catalog_4.py index 55c9a961..125bbdf5 100644 --- a/docs_src/tutorials/using_a_data_catalog_4.py +++ b/docs_src/tutorials/using_a_data_catalog_4.py @@ -2,7 +2,6 @@ from pytask import DataCatalog - SRC = Path(__file__).parent.resolve() BLD = SRC.joinpath("..", "..", "bld").resolve() diff --git a/docs_src/tutorials/visualizing_the_dag.py b/docs_src/tutorials/visualizing_the_dag.py index 6eaf4297..e0597abb 100644 --- a/docs_src/tutorials/visualizing_the_dag.py +++ b/docs_src/tutorials/visualizing_the_dag.py @@ -3,8 +3,8 @@ import networkx as nx from my_project.config import BLD from my_project.config import SRC -from pytask import build_dag from pytask import Product +from pytask import build_dag from typing_extensions import Annotated diff --git a/pyproject.toml b/pyproject.toml index 19c17c80..9a0ef132 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,13 +106,13 @@ namespaces = false [tool.ruff] target-version = "py38" fix = true +unsafe-fixes = true extend-include = ["*.ipynb"] [tool.ruff.lint] select = ["ALL"] ignore = [ "FBT", # flake8-boolean-trap - "I", # ignore isort "TRY", # ignore tryceratops. # Others. "ANN101", # type annotating self @@ -146,6 +146,8 @@ ignore = [ "docs_src/how_to_guides/writing_custom_nodes_*.py" = ["S301"] "docs_src/tutorials/using_a_data_catalog_*.py" = ["RET504"] +[tool.ruff.lint.isort] +force-single-line = true [tool.ruff.lint.pydocstyle] convention = "numpy" diff --git a/scripts/update_plugin_list.py b/scripts/update_plugin_list.py index 4acc6c72..7ce2978b 100644 --- a/scripts/update_plugin_list.py +++ b/scripts/update_plugin_list.py @@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE. """ + from __future__ import annotations import datetime @@ -42,7 +43,6 @@ import wcwidth from tqdm import tqdm - _FILE_HEAD = r""" .. _plugin-list: diff --git a/src/_pytask/__init__.py b/src/_pytask/__init__.py index 191a7fa9..e7520ee8 100644 --- a/src/_pytask/__init__.py +++ b/src/_pytask/__init__.py @@ -1,6 +1,6 @@ """Should not contain any imports except for the version.""" -from __future__ import annotations +from __future__ import annotations try: from ._version import version as __version__ diff --git a/src/_pytask/_inspect.py b/src/_pytask/_inspect.py index 10b61d8e..a6a5a730 100644 --- a/src/_pytask/_inspect.py +++ b/src/_pytask/_inspect.py @@ -7,7 +7,6 @@ from typing import Callable from typing import Mapping - __all__ = ["get_annotations"] diff --git a/src/_pytask/build.py b/src/_pytask/build.py index 83a06ddb..fe0c2c1e 100644 --- a/src/_pytask/build.py +++ b/src/_pytask/build.py @@ -1,17 +1,20 @@ """Implement the build command.""" + from __future__ import annotations import json import sys from contextlib import suppress from pathlib import Path +from typing import TYPE_CHECKING from typing import Any from typing import Callable from typing import Iterable from typing import Literal -from typing import TYPE_CHECKING import click +from rich.traceback import Traceback + from _pytask.capture_utils import CaptureMethod from _pytask.capture_utils import ShowCapture from _pytask.click import ColoredCommand @@ -31,13 +34,12 @@ from _pytask.shared import parse_paths from _pytask.shared import to_list from _pytask.traceback import remove_internal_traceback_frames_from_exc_info -from rich.traceback import Traceback - if TYPE_CHECKING: - from _pytask.node_protocols import PTask from typing import NoReturn + from _pytask.node_protocols import PTask + @hookimpl(tryfirst=True) def pytask_extend_command_line_interface(cli: click.Group) -> None: diff --git a/src/_pytask/cache.py b/src/_pytask/cache.py index 2a5ad79d..a7a1f3c7 100644 --- a/src/_pytask/cache.py +++ b/src/_pytask/cache.py @@ -1,4 +1,5 @@ """Contains a cache.""" + from __future__ import annotations import functools @@ -8,10 +9,11 @@ from typing import Any from typing import Callable -from _pytask._hashlib import hash_value from attrs import define from attrs import field +from _pytask._hashlib import hash_value + @define class CacheInfo: diff --git a/src/_pytask/capture.py b/src/_pytask/capture.py index 006d8db1..951cc506 100644 --- a/src/_pytask/capture.py +++ b/src/_pytask/capture.py @@ -22,6 +22,7 @@ `_. """ + from __future__ import annotations import contextlib @@ -31,16 +32,17 @@ import sys from io import UnsupportedOperation from tempfile import TemporaryFile +from typing import TYPE_CHECKING from typing import Any from typing import AnyStr -from typing import final from typing import Generator from typing import Generic from typing import Iterator from typing import TextIO -from typing import TYPE_CHECKING +from typing import final import click + from _pytask.capture_utils import CaptureMethod from _pytask.capture_utils import ShowCapture from _pytask.click import EnumChoice @@ -386,7 +388,7 @@ def __init__(self, targetfd: int) -> None: self._state = "initialized" def __repr__(self) -> str: - return "<{} {} oldfd={} _state={!r} tmpfile={!r}>".format( + return "<{} {} oldfd={} _state={!r} tmpfile={!r}>".format( # noqa: UP032 self.__class__.__name__, self.targetfd, self.targetfd_save, @@ -566,7 +568,7 @@ def __init__( self.err = err def __repr__(self) -> str: - return ( + return ( # noqa: UP032 "" ).format( @@ -680,7 +682,7 @@ def __init__(self, method: CaptureMethod) -> None: self._capturing: MultiCapture[str] | None = None def __repr__(self) -> str: - return ("").format( + return ("").format( # noqa: UP032 self._method, self._capturing ) diff --git a/src/_pytask/capture_utils.py b/src/_pytask/capture_utils.py index 18da8d42..47a8376b 100644 --- a/src/_pytask/capture_utils.py +++ b/src/_pytask/capture_utils.py @@ -1,4 +1,5 @@ """A module for enums shared across the codebase.""" + from __future__ import annotations import enum diff --git a/src/_pytask/clean.py b/src/_pytask/clean.py index 61e9ee08..a4980f3e 100644 --- a/src/_pytask/clean.py +++ b/src/_pytask/clean.py @@ -1,4 +1,5 @@ """Add a command to clean the project from files unknown to pytask.""" + from __future__ import annotations import enum @@ -6,12 +7,14 @@ import shutil import sys from pathlib import Path +from typing import TYPE_CHECKING from typing import Any from typing import Generator from typing import Iterable -from typing import TYPE_CHECKING import click +from attrs import define + from _pytask.click import ColoredCommand from _pytask.click import EnumChoice from _pytask.console import console @@ -31,8 +34,6 @@ from _pytask.shared import to_list from _pytask.traceback import Traceback from _pytask.tree_util import tree_leaves -from attrs import define - if TYPE_CHECKING: from typing import NoReturn diff --git a/src/_pytask/cli.py b/src/_pytask/cli.py index f6d6b450..13046646 100644 --- a/src/_pytask/cli.py +++ b/src/_pytask/cli.py @@ -1,13 +1,14 @@ """Implements the command line interface.""" + from __future__ import annotations from typing import Any import click -from _pytask.click import ColoredGroup -from _pytask.pluginmanager import storage from packaging.version import parse as parse_version +from _pytask.click import ColoredGroup +from _pytask.pluginmanager import storage _CONTEXT_SETTINGS: dict[str, Any] = { "help_option_names": ("-h", "--help"), diff --git a/src/_pytask/click.py b/src/_pytask/click.py index 35e9fd9b..6daab734 100644 --- a/src/_pytask/click.py +++ b/src/_pytask/click.py @@ -1,17 +1,16 @@ """Contains code related to click.""" + from __future__ import annotations import inspect from enum import Enum from gettext import gettext as _ from gettext import ngettext +from typing import TYPE_CHECKING from typing import Any from typing import ClassVar -from typing import TYPE_CHECKING import click -from _pytask import __version__ as version -from _pytask.console import console from click import Choice from click import Command from click import Context @@ -23,6 +22,9 @@ from rich.table import Table from rich.text import Text +from _pytask import __version__ as version +from _pytask.console import console + if TYPE_CHECKING: from collections.abc import Sequence diff --git a/src/_pytask/collect.py b/src/_pytask/collect.py index bca6d070..804c06bf 100644 --- a/src/_pytask/collect.py +++ b/src/_pytask/collect.py @@ -1,4 +1,5 @@ """Implement functionality to collect tasks.""" + from __future__ import annotations import inspect @@ -7,10 +8,13 @@ import sys import time from pathlib import Path +from typing import TYPE_CHECKING from typing import Any from typing import Generator from typing import Iterable -from typing import TYPE_CHECKING + +from rich.text import Text +from upath import UPath from _pytask.collect_utils import create_name_of_python_node from _pytask.collect_utils import parse_dependencies_from_task_function @@ -43,13 +47,10 @@ from _pytask.task_utils import COLLECTED_TASKS from _pytask.task_utils import task as task_decorator from _pytask.typing import is_task_function -from rich.text import Text -from upath import UPath - if TYPE_CHECKING: - from _pytask.session import Session from _pytask.models import NodeInfo + from _pytask.session import Session @hookimpl diff --git a/src/_pytask/collect_command.py b/src/_pytask/collect_command.py index f9181643..79f8dfcb 100644 --- a/src/_pytask/collect_command.py +++ b/src/_pytask/collect_command.py @@ -1,20 +1,24 @@ """Contains the implementation of ``pytask collect``.""" + from __future__ import annotations import sys from collections import defaultdict -from typing import Any from typing import TYPE_CHECKING +from typing import Any import click +from rich.text import Text +from rich.tree import Tree + from _pytask.click import ColoredCommand +from _pytask.console import FILE_ICON +from _pytask.console import PYTHON_ICON +from _pytask.console import TASK_ICON from _pytask.console import console from _pytask.console import create_url_style_for_path -from _pytask.console import FILE_ICON from _pytask.console import format_node_name from _pytask.console import format_task_name -from _pytask.console import PYTHON_ICON -from _pytask.console import TASK_ICON from _pytask.exceptions import CollectionError from _pytask.exceptions import ConfigurationError from _pytask.exceptions import ResolvingDependenciesError @@ -30,9 +34,6 @@ from _pytask.pluginmanager import storage from _pytask.session import Session from _pytask.tree_util import tree_leaves -from rich.text import Text -from rich.tree import Tree - if TYPE_CHECKING: from pathlib import Path diff --git a/src/_pytask/collect_utils.py b/src/_pytask/collect_utils.py index 32a15ecd..04ac4bd4 100644 --- a/src/_pytask/collect_utils.py +++ b/src/_pytask/collect_utils.py @@ -1,13 +1,16 @@ """Contains utility functions for :mod:`_pytask.collect`.""" + from __future__ import annotations import inspect import sys +from typing import TYPE_CHECKING from typing import Any from typing import Callable -from typing import TYPE_CHECKING import attrs +from typing_extensions import get_origin + from _pytask._inspect import get_annotations from _pytask.exceptions import NodeNotCollectedError from _pytask.models import NodeInfo @@ -16,9 +19,8 @@ from _pytask.task_utils import parse_keyword_arguments_from_signature_defaults from _pytask.tree_util import tree_leaves from _pytask.tree_util import tree_map_with_path -from _pytask.typing import no_default from _pytask.typing import ProductType -from typing_extensions import get_origin +from _pytask.typing import no_default if sys.version_info >= (3, 9): from typing import Annotated @@ -27,6 +29,7 @@ if TYPE_CHECKING: from pathlib import Path + from _pytask.session import Session diff --git a/src/_pytask/compat.py b/src/_pytask/compat.py index d392576e..e1442f18 100644 --- a/src/_pytask/compat.py +++ b/src/_pytask/compat.py @@ -1,4 +1,5 @@ """Contains functions to assess compatibility and optional dependencies.""" + from __future__ import annotations import shutil diff --git a/src/_pytask/config.py b/src/_pytask/config.py index d42d5eed..ac4775da 100644 --- a/src/_pytask/config.py +++ b/src/_pytask/config.py @@ -1,10 +1,11 @@ """Configure pytask.""" + from __future__ import annotations import tempfile from pathlib import Path -from typing import Any from typing import TYPE_CHECKING +from typing import Any from _pytask.pluginmanager import hookimpl from _pytask.shared import parse_markers diff --git a/src/_pytask/config_utils.py b/src/_pytask/config_utils.py index efeecfaf..e78934d1 100644 --- a/src/_pytask/config_utils.py +++ b/src/_pytask/config_utils.py @@ -1,4 +1,5 @@ """Contains helper functions for the configuration.""" + from __future__ import annotations import os @@ -8,6 +9,7 @@ from typing import Sequence import click + from _pytask.shared import parse_paths if sys.version_info >= (3, 11): # pragma: no cover diff --git a/src/_pytask/console.py b/src/_pytask/console.py index 01f9467f..4bd1b04b 100644 --- a/src/_pytask/console.py +++ b/src/_pytask/console.py @@ -1,4 +1,5 @@ """Contains the code to format output on the command line.""" + from __future__ import annotations import functools @@ -7,17 +8,13 @@ import sys from contextlib import suppress from pathlib import Path +from typing import TYPE_CHECKING from typing import Any from typing import Callable from typing import Iterable from typing import Literal from typing import Sequence -from typing import TYPE_CHECKING -from _pytask.node_protocols import PNode -from _pytask.node_protocols import PPathNode -from _pytask.node_protocols import PTaskWithPath -from _pytask.path import shorten_path from rich.console import Console from rich.console import RenderableType from rich.padding import Padding @@ -29,10 +26,15 @@ from rich.theme import Theme from rich.tree import Tree +from _pytask.node_protocols import PNode +from _pytask.node_protocols import PPathNode +from _pytask.node_protocols import PTaskWithPath +from _pytask.path import shorten_path if TYPE_CHECKING: - from _pytask.node_protocols import PTask from enum import Enum + + from _pytask.node_protocols import PTask from _pytask.outcomes import CollectionOutcome from _pytask.outcomes import TaskOutcome diff --git a/src/_pytask/dag.py b/src/_pytask/dag.py index 89941b74..9ebc7425 100644 --- a/src/_pytask/dag.py +++ b/src/_pytask/dag.py @@ -1,4 +1,5 @@ """Contains code related to resolving dependencies.""" + from __future__ import annotations import itertools @@ -6,13 +7,16 @@ from typing import TYPE_CHECKING import networkx as nx +from rich.text import Text +from rich.tree import Tree + from _pytask.console import ARROW_DOWN_ICON -from _pytask.console import console from _pytask.console import FILE_ICON +from _pytask.console import TASK_ICON +from _pytask.console import console from _pytask.console import format_node_name from _pytask.console import format_task_name from _pytask.console import render_to_string -from _pytask.console import TASK_ICON from _pytask.exceptions import ResolvingDependenciesError from _pytask.mark import select_by_after_keyword from _pytask.node_protocols import PNode @@ -22,11 +26,10 @@ from _pytask.reports import DagReport from _pytask.shared import reduce_names_of_multiple_nodes from _pytask.tree_util import tree_map -from rich.text import Text -from rich.tree import Tree if TYPE_CHECKING: from pathlib import Path + from _pytask.session import Session diff --git a/src/_pytask/dag_command.py b/src/_pytask/dag_command.py index 8906bb4c..ef84fa47 100644 --- a/src/_pytask/dag_command.py +++ b/src/_pytask/dag_command.py @@ -1,4 +1,5 @@ """Contains the command and code for drawing the DAG.""" + from __future__ import annotations import enum @@ -8,6 +9,9 @@ import click import networkx as nx +from rich.text import Text +from rich.traceback import Traceback + from _pytask.click import ColoredCommand from _pytask.click import EnumChoice from _pytask.compat import check_for_optional_program @@ -27,8 +31,6 @@ from _pytask.shared import reduce_names_of_multiple_nodes from _pytask.shared import to_list from _pytask.traceback import remove_internal_traceback_frames_from_exc_info -from rich.text import Text -from rich.traceback import Traceback class _RankDirection(enum.Enum): diff --git a/src/_pytask/dag_utils.py b/src/_pytask/dag_utils.py index c66c46ec..e6b583c1 100644 --- a/src/_pytask/dag_utils.py +++ b/src/_pytask/dag_utils.py @@ -1,16 +1,18 @@ """Implement some capabilities to deal with the DAG.""" + from __future__ import annotations import itertools +from typing import TYPE_CHECKING from typing import Generator from typing import Iterable -from typing import TYPE_CHECKING import networkx as nx -from _pytask.mark_utils import has_mark from attrs import define from attrs import field +from _pytask.mark_utils import has_mark + if TYPE_CHECKING: from _pytask.node_protocols import PTask diff --git a/src/_pytask/data_catalog.py b/src/_pytask/data_catalog.py index 20b63b56..ec0a6d67 100644 --- a/src/_pytask/data_catalog.py +++ b/src/_pytask/data_catalog.py @@ -3,6 +3,7 @@ The data catalog is an abstraction layer between users and nodes. """ + from __future__ import annotations import hashlib @@ -11,6 +12,9 @@ from pathlib import Path from typing import Any +from attrs import define +from attrs import field + from _pytask.config_utils import find_project_root_and_config from _pytask.exceptions import NodeNotCollectedError from _pytask.models import NodeInfo @@ -19,9 +23,6 @@ from _pytask.nodes import PickleNode from _pytask.pluginmanager import storage from _pytask.session import Session -from attrs import define -from attrs import field - __all__ = ["DataCatalog"] diff --git a/src/_pytask/database.py b/src/_pytask/database.py index 2a19a459..dfdf96b3 100644 --- a/src/_pytask/database.py +++ b/src/_pytask/database.py @@ -1,12 +1,14 @@ """Contains hooks related to the database.""" + from __future__ import annotations from pathlib import Path from typing import Any +from sqlalchemy.engine import make_url + from _pytask.database_utils import create_database from _pytask.pluginmanager import hookimpl -from sqlalchemy.engine import make_url @hookimpl diff --git a/src/_pytask/database_utils.py b/src/_pytask/database_utils.py index 1e26b9f8..0d20e0ae 100644 --- a/src/_pytask/database_utils.py +++ b/src/_pytask/database_utils.py @@ -1,15 +1,17 @@ """Contains utilities for the database.""" + from __future__ import annotations from typing import TYPE_CHECKING -from _pytask.dag_utils import node_and_neighbors from sqlalchemy import create_engine from sqlalchemy.orm import DeclarativeBase from sqlalchemy.orm import Mapped from sqlalchemy.orm import mapped_column from sqlalchemy.orm import sessionmaker +from _pytask.dag_utils import node_and_neighbors + if TYPE_CHECKING: from _pytask.node_protocols import PNode from _pytask.node_protocols import PTask diff --git a/src/_pytask/debugging.py b/src/_pytask/debugging.py index 88eaef5c..6929c312 100644 --- a/src/_pytask/debugging.py +++ b/src/_pytask/debugging.py @@ -1,15 +1,17 @@ """Contains everything related to debugging.""" + from __future__ import annotations import functools import pdb # noqa: T100 import sys +from typing import TYPE_CHECKING from typing import Any from typing import ClassVar from typing import Generator -from typing import TYPE_CHECKING import click + from _pytask.console import console from _pytask.node_protocols import PTask from _pytask.outcomes import Exit @@ -17,12 +19,14 @@ from _pytask.traceback import Traceback if TYPE_CHECKING: - from pluggy import PluginManager - from _pytask.session import Session - from types import TracebackType from types import FrameType + from types import TracebackType + + from pluggy import PluginManager + from _pytask.capture import CaptureManager from _pytask.live import LiveManager + from _pytask.session import Session @hookimpl diff --git a/src/_pytask/exceptions.py b/src/_pytask/exceptions.py index 121b9147..726512c9 100644 --- a/src/_pytask/exceptions.py +++ b/src/_pytask/exceptions.py @@ -1,4 +1,5 @@ """Contains custom exceptions.""" + from __future__ import annotations diff --git a/src/_pytask/execute.py b/src/_pytask/execute.py index e58f3173..08c4cdaa 100644 --- a/src/_pytask/execute.py +++ b/src/_pytask/execute.py @@ -1,11 +1,14 @@ """Contains hook implementations concerning the execution.""" + from __future__ import annotations import inspect import sys import time -from typing import Any from typing import TYPE_CHECKING +from typing import Any + +from rich.text import Text from _pytask.config import IS_FILE_SYSTEM_CASE_SENSITIVE from _pytask.console import console @@ -14,9 +17,9 @@ from _pytask.console import format_node_name from _pytask.console import format_strings_as_flat_tree from _pytask.console import unify_styles +from _pytask.dag_utils import TopologicalSorter from _pytask.dag_utils import descending_tasks from _pytask.dag_utils import node_and_neighbors -from _pytask.dag_utils import TopologicalSorter from _pytask.database_utils import has_node_changed from _pytask.database_utils import update_states_in_database from _pytask.exceptions import ExecutionError @@ -27,19 +30,17 @@ from _pytask.node_protocols import PNode from _pytask.node_protocols import PPathNode from _pytask.node_protocols import PTask -from _pytask.outcomes import count_outcomes from _pytask.outcomes import Exit from _pytask.outcomes import SkippedUnchanged from _pytask.outcomes import TaskOutcome from _pytask.outcomes import WouldBeExecuted +from _pytask.outcomes import count_outcomes from _pytask.pluginmanager import hookimpl from _pytask.reports import ExecutionReport from _pytask.traceback import remove_traceback_from_exc_info from _pytask.tree_util import tree_leaves from _pytask.tree_util import tree_map from _pytask.tree_util import tree_structure -from rich.text import Text - if TYPE_CHECKING: from _pytask.session import Session diff --git a/src/_pytask/git.py b/src/_pytask/git.py index d6e1769c..fe0fa2be 100644 --- a/src/_pytask/git.py +++ b/src/_pytask/git.py @@ -1,4 +1,5 @@ """Contains all functions related to git.""" + from __future__ import annotations import shutil diff --git a/src/_pytask/hookspecs.py b/src/_pytask/hookspecs.py index a1d34a69..9ca83367 100644 --- a/src/_pytask/hookspecs.py +++ b/src/_pytask/hookspecs.py @@ -4,28 +4,30 @@ the message send by the host and may send a response. """ + from __future__ import annotations -from typing import Any from typing import TYPE_CHECKING +from typing import Any import pluggy - if TYPE_CHECKING: + from pathlib import Path + + import click + import networkx as nx + from pluggy import PluginManager + from _pytask.models import NodeInfo from _pytask.node_protocols import PNode - import click from _pytask.node_protocols import PTask - import networkx as nx - from pathlib import Path - from _pytask.session import Session from _pytask.outcomes import CollectionOutcome from _pytask.outcomes import TaskOutcome from _pytask.reports import CollectionReport - from _pytask.reports import ExecutionReport from _pytask.reports import DagReport - from pluggy import PluginManager + from _pytask.reports import ExecutionReport + from _pytask.session import Session hookspec = pluggy.HookspecMarker("pytask") diff --git a/src/_pytask/live.py b/src/_pytask/live.py index 7cd616da..3e279f71 100644 --- a/src/_pytask/live.py +++ b/src/_pytask/live.py @@ -1,17 +1,13 @@ """Contains code related to live objects.""" + from __future__ import annotations +from typing import TYPE_CHECKING from typing import Any from typing import Generator from typing import NamedTuple -from typing import TYPE_CHECKING import click -from _pytask.console import console -from _pytask.console import format_task_name -from _pytask.outcomes import CollectionOutcome -from _pytask.outcomes import TaskOutcome -from _pytask.pluginmanager import hookimpl from attrs import define from attrs import field from rich.box import ROUNDED @@ -21,11 +17,17 @@ from rich.table import Table from rich.text import Text +from _pytask.console import console +from _pytask.console import format_task_name +from _pytask.outcomes import CollectionOutcome +from _pytask.outcomes import TaskOutcome +from _pytask.pluginmanager import hookimpl + if TYPE_CHECKING: from _pytask.node_protocols import PTask + from _pytask.reports import CollectionReport from _pytask.reports import ExecutionReport from _pytask.session import Session - from _pytask.reports import CollectionReport @hookimpl diff --git a/src/_pytask/logging.py b/src/_pytask/logging.py index 6dedd1c4..545562a1 100644 --- a/src/_pytask/logging.py +++ b/src/_pytask/logging.py @@ -1,29 +1,32 @@ """Add general logging capabilities.""" + from __future__ import annotations import contextlib import platform import sys import warnings +from typing import TYPE_CHECKING from typing import Any from typing import NamedTuple -from typing import TYPE_CHECKING -import _pytask import click import pluggy -from _pytask.console import console +from rich.text import Text + +import _pytask from _pytask.console import IS_WINDOWS_TERMINAL +from _pytask.console import console from _pytask.pluginmanager import hookimpl from _pytask.reports import ExecutionReport from _pytask.traceback import Traceback -from rich.text import Text if TYPE_CHECKING: from pluggy._manager import DistFacade + + from _pytask.outcomes import CollectionOutcome from _pytask.outcomes import TaskOutcome from _pytask.session import Session - from _pytask.outcomes import CollectionOutcome with contextlib.suppress(ImportError): diff --git a/src/_pytask/mark/__init__.py b/src/_pytask/mark/__init__.py index a8ffe2ab..1c116c7a 100644 --- a/src/_pytask/mark/__init__.py +++ b/src/_pytask/mark/__init__.py @@ -1,20 +1,24 @@ """Contains the main code for the markers plugin.""" + from __future__ import annotations import sys +from typing import TYPE_CHECKING from typing import AbstractSet from typing import Any -from typing import TYPE_CHECKING import click +from attrs import define +from rich.table import Table + from _pytask.click import ColoredCommand from _pytask.console import console from _pytask.dag_utils import task_and_preceding_tasks from _pytask.exceptions import ConfigurationError from _pytask.mark.expression import Expression from _pytask.mark.expression import ParseError -from _pytask.mark.structures import Mark from _pytask.mark.structures import MARK_GEN +from _pytask.mark.structures import Mark from _pytask.mark.structures import MarkDecorator from _pytask.mark.structures import MarkGenerator from _pytask.outcomes import ExitCode @@ -22,15 +26,14 @@ from _pytask.pluginmanager import storage from _pytask.session import Session from _pytask.shared import parse_markers -from attrs import define -from rich.table import Table - if TYPE_CHECKING: - from _pytask.node_protocols import PTask - import networkx as nx from typing import NoReturn + import networkx as nx + + from _pytask.node_protocols import PTask + __all__ = [ "Expression", diff --git a/src/_pytask/mark/expression.py b/src/_pytask/mark/expression.py index 6a70cd9a..f0aaa59b 100644 --- a/src/_pytask/mark/expression.py +++ b/src/_pytask/mark/expression.py @@ -21,20 +21,20 @@ - or/and/not evaluate according to the usual boolean semantics. """ + from __future__ import annotations import ast import enum import re +from typing import TYPE_CHECKING from typing import Callable from typing import Iterator from typing import Mapping from typing import Sequence -from typing import TYPE_CHECKING from attrs import define - if TYPE_CHECKING: import types from typing import NoReturn diff --git a/src/_pytask/mark/structures.py b/src/_pytask/mark/structures.py index 74ec21cb..a448a5e4 100644 --- a/src/_pytask/mark/structures.py +++ b/src/_pytask/mark/structures.py @@ -6,13 +6,14 @@ from typing import Iterable from typing import Mapping -from _pytask.mark_utils import get_all_marks -from _pytask.models import CollectionMetadata -from _pytask.typing import is_task_function from attrs import define from attrs import field from attrs import validators +from _pytask.mark_utils import get_all_marks +from _pytask.models import CollectionMetadata +from _pytask.typing import is_task_function + @define(frozen=True) class Mark: diff --git a/src/_pytask/mark_utils.py b/src/_pytask/mark_utils.py index de9eb026..4ee0e50c 100644 --- a/src/_pytask/mark_utils.py +++ b/src/_pytask/mark_utils.py @@ -3,15 +3,15 @@ The utility functions are stored here to be separate from the plugin. """ + from __future__ import annotations -from typing import Any from typing import TYPE_CHECKING +from typing import Any from _pytask.models import CollectionMetadata from _pytask.node_protocols import PTask - if TYPE_CHECKING: from _pytask.mark import Mark diff --git a/src/_pytask/models.py b/src/_pytask/models.py index 1427b487..24a0559b 100644 --- a/src/_pytask/models.py +++ b/src/_pytask/models.py @@ -1,10 +1,11 @@ """Contains code on models, containers and there like.""" + from __future__ import annotations +from typing import TYPE_CHECKING from typing import Any from typing import Callable from typing import NamedTuple -from typing import TYPE_CHECKING from uuid import UUID from uuid import uuid4 @@ -13,8 +14,9 @@ if TYPE_CHECKING: from pathlib import Path - from _pytask.tree_util import PyTree + from _pytask.mark import Mark + from _pytask.tree_util import PyTree @define diff --git a/src/_pytask/node_protocols.py b/src/_pytask/node_protocols.py index 070d9497..58a6fc50 100644 --- a/src/_pytask/node_protocols.py +++ b/src/_pytask/node_protocols.py @@ -1,16 +1,16 @@ from __future__ import annotations +from typing import TYPE_CHECKING from typing import Any from typing import Callable from typing import Protocol from typing import runtime_checkable -from typing import TYPE_CHECKING - if TYPE_CHECKING: - from _pytask.tree_util import PyTree from pathlib import Path + from _pytask.mark import Mark + from _pytask.tree_util import PyTree __all__ = ["PNode", "PPathNode", "PTask", "PTaskWithPath"] diff --git a/src/_pytask/nodes.py b/src/_pytask/nodes.py index 5cc3506b..e98a0f6d 100644 --- a/src/_pytask/nodes.py +++ b/src/_pytask/nodes.py @@ -1,4 +1,5 @@ """Contains implementations of tasks and nodes following the node protocols.""" + from __future__ import annotations import hashlib @@ -6,9 +7,13 @@ import pickle from os import stat_result from pathlib import Path # noqa: TCH003 +from typing import TYPE_CHECKING from typing import Any from typing import Callable -from typing import TYPE_CHECKING + +from attrs import define +from attrs import field +from upath._stat import UPathStatResult from _pytask._hashlib import hash_value from _pytask.node_protocols import PNode @@ -16,17 +21,13 @@ from _pytask.node_protocols import PTask from _pytask.node_protocols import PTaskWithPath from _pytask.path import hash_path -from _pytask.typing import no_default from _pytask.typing import NoDefault -from attrs import define -from attrs import field -from upath._stat import UPathStatResult - +from _pytask.typing import no_default if TYPE_CHECKING: + from _pytask.mark import Mark from _pytask.models import NodeInfo from _pytask.tree_util import PyTree - from _pytask.mark import Mark __all__ = ["PathNode", "PickleNode", "PythonNode", "Task", "TaskWithoutPath"] diff --git a/src/_pytask/outcomes.py b/src/_pytask/outcomes.py index 626810bd..524f0975 100644 --- a/src/_pytask/outcomes.py +++ b/src/_pytask/outcomes.py @@ -1,12 +1,12 @@ """Contains code related to outcomes.""" + from __future__ import annotations -from enum import auto from enum import Enum from enum import IntEnum -from typing import Sequence +from enum import auto from typing import TYPE_CHECKING - +from typing import Sequence if TYPE_CHECKING: from _pytask.reports import CollectionReport diff --git a/src/_pytask/parameters.py b/src/_pytask/parameters.py index 7805ed32..c3e32f0b 100644 --- a/src/_pytask/parameters.py +++ b/src/_pytask/parameters.py @@ -1,21 +1,23 @@ """Contains common parameters for the commands of the command line interface.""" + from __future__ import annotations import importlib.util from pathlib import Path -from typing import Iterable from typing import TYPE_CHECKING +from typing import Iterable import click +from click import Context +from sqlalchemy.engine import URL +from sqlalchemy.engine import make_url +from sqlalchemy.exc import ArgumentError + from _pytask.config_utils import set_defaults_from_config from _pytask.path import import_path from _pytask.pluginmanager import hookimpl from _pytask.pluginmanager import register_hook_impls_from_modules from _pytask.pluginmanager import storage -from click import Context -from sqlalchemy.engine import make_url -from sqlalchemy.engine import URL -from sqlalchemy.exc import ArgumentError if TYPE_CHECKING: from pluggy import PluginManager diff --git a/src/_pytask/path.py b/src/_pytask/path.py index 86968b8c..05027092 100644 --- a/src/_pytask/path.py +++ b/src/_pytask/path.py @@ -1,4 +1,5 @@ """Contains code to handle paths.""" + from __future__ import annotations import contextlib @@ -13,7 +14,6 @@ from _pytask._hashlib import file_digest from _pytask.cache import Cache - __all__ = [ "find_case_sensitive_path", "find_closest_ancestor", diff --git a/src/_pytask/persist.py b/src/_pytask/persist.py index bb74d3bb..d4a56c25 100644 --- a/src/_pytask/persist.py +++ b/src/_pytask/persist.py @@ -1,8 +1,9 @@ """Implement the ability for tasks to persist.""" + from __future__ import annotations -from typing import Any from typing import TYPE_CHECKING +from typing import Any from _pytask.dag_utils import node_and_neighbors from _pytask.database_utils import has_node_changed @@ -12,11 +13,10 @@ from _pytask.outcomes import TaskOutcome from _pytask.pluginmanager import hookimpl - if TYPE_CHECKING: from _pytask.node_protocols import PTask - from _pytask.session import Session from _pytask.reports import ExecutionReport + from _pytask.session import Session @hookimpl diff --git a/src/_pytask/pluginmanager.py b/src/_pytask/pluginmanager.py index 931e12a8..3159915c 100644 --- a/src/_pytask/pluginmanager.py +++ b/src/_pytask/pluginmanager.py @@ -1,15 +1,16 @@ """Contains the plugin manager.""" + from __future__ import annotations import importlib import sys from typing import Iterable -from _pytask import hookspecs from attrs import define from pluggy import HookimplMarker from pluggy import PluginManager +from _pytask import hookspecs __all__ = [ "get_plugin_manager", diff --git a/src/_pytask/profile.py b/src/_pytask/profile.py index 97cbb14d..50e25985 100644 --- a/src/_pytask/profile.py +++ b/src/_pytask/profile.py @@ -1,4 +1,5 @@ """Contains the code to profile the execution.""" + from __future__ import annotations import csv @@ -7,11 +8,15 @@ import sys import time from contextlib import suppress +from typing import TYPE_CHECKING from typing import Any from typing import Generator -from typing import TYPE_CHECKING import click +from rich.table import Table +from sqlalchemy.orm import Mapped +from sqlalchemy.orm import mapped_column + from _pytask.click import ColoredCommand from _pytask.click import EnumChoice from _pytask.console import console @@ -28,15 +33,13 @@ from _pytask.pluginmanager import storage from _pytask.session import Session from _pytask.traceback import Traceback -from rich.table import Table -from sqlalchemy.orm import Mapped -from sqlalchemy.orm import mapped_column if TYPE_CHECKING: - from _pytask.reports import ExecutionReport from pathlib import Path from typing import NoReturn + from _pytask.reports import ExecutionReport + class _ExportFormats(enum.Enum): NO = "no" diff --git a/src/_pytask/reports.py b/src/_pytask/reports.py index afea46e5..40da6cca 100644 --- a/src/_pytask/reports.py +++ b/src/_pytask/reports.py @@ -1,8 +1,14 @@ """Contains everything related to reports.""" + from __future__ import annotations -from typing import ClassVar from typing import TYPE_CHECKING +from typing import ClassVar + +from attrs import define +from attrs import field +from rich.rule import Rule +from rich.text import Text from _pytask.capture_utils import ShowCapture from _pytask.console import format_task_name @@ -10,18 +16,14 @@ from _pytask.outcomes import TaskOutcome from _pytask.traceback import OptionalExceptionInfo from _pytask.traceback import Traceback -from attrs import define -from attrs import field -from rich.rule import Rule -from rich.text import Text - if TYPE_CHECKING: - from _pytask.node_protocols import PNode - from _pytask.node_protocols import PTask from rich.console import Console - from rich.console import RenderResult from rich.console import ConsoleOptions + from rich.console import RenderResult + + from _pytask.node_protocols import PNode + from _pytask.node_protocols import PTask @define diff --git a/src/_pytask/session.py b/src/_pytask/session.py index ae772e7a..871503b6 100644 --- a/src/_pytask/session.py +++ b/src/_pytask/session.py @@ -1,21 +1,23 @@ """Contains code related to the session object.""" + from __future__ import annotations -from typing import Any from typing import TYPE_CHECKING +from typing import Any import networkx as nx -from _pytask.outcomes import ExitCode from attrs import define from attrs import field from pluggy import HookRelay +from _pytask.outcomes import ExitCode + if TYPE_CHECKING: from _pytask.node_protocols import PTask - from _pytask.warnings_utils import WarningReport from _pytask.reports import CollectionReport - from _pytask.reports import ExecutionReport from _pytask.reports import DagReport + from _pytask.reports import ExecutionReport + from _pytask.warnings_utils import WarningReport @define(kw_only=True) diff --git a/src/_pytask/shared.py b/src/_pytask/shared.py index 40e10970..3b62dc1a 100644 --- a/src/_pytask/shared.py +++ b/src/_pytask/shared.py @@ -1,14 +1,16 @@ """Functions which are used across various modules.""" + from __future__ import annotations import glob from pathlib import Path +from typing import TYPE_CHECKING from typing import Any from typing import Iterable from typing import Sequence -from typing import TYPE_CHECKING import click + from _pytask.console import format_node_name from _pytask.console import format_task_name from _pytask.node_protocols import PNode @@ -16,6 +18,7 @@ if TYPE_CHECKING: from enum import Enum + import networkx as nx diff --git a/src/_pytask/skipping.py b/src/_pytask/skipping.py index 7264095e..b28ff8d1 100644 --- a/src/_pytask/skipping.py +++ b/src/_pytask/skipping.py @@ -1,8 +1,9 @@ """Contains everything related to skipping tasks.""" + from __future__ import annotations -from typing import Any from typing import TYPE_CHECKING +from typing import Any from _pytask.dag_utils import descending_tasks from _pytask.mark import Mark @@ -14,11 +15,10 @@ from _pytask.outcomes import TaskOutcome from _pytask.pluginmanager import hookimpl - if TYPE_CHECKING: from _pytask.node_protocols import PTask - from _pytask.session import Session from _pytask.reports import ExecutionReport + from _pytask.session import Session def skip_ancestor_failed(reason: str = "No reason provided.") -> str: diff --git a/src/_pytask/task.py b/src/_pytask/task.py index fc029ab8..f1a0c213 100644 --- a/src/_pytask/task.py +++ b/src/_pytask/task.py @@ -1,9 +1,10 @@ """Contain hooks related to the :func:`@task `.""" + from __future__ import annotations +from typing import TYPE_CHECKING from typing import Any from typing import Callable -from typing import TYPE_CHECKING from _pytask.console import format_strings_as_flat_tree from _pytask.pluginmanager import hookimpl @@ -12,9 +13,10 @@ from _pytask.task_utils import parse_collected_tasks_with_task_marker if TYPE_CHECKING: + from pathlib import Path + from _pytask.reports import CollectionReport from _pytask.session import Session - from pathlib import Path @hookimpl diff --git a/src/_pytask/task_utils.py b/src/_pytask/task_utils.py index c5e00521..9727968b 100644 --- a/src/_pytask/task_utils.py +++ b/src/_pytask/task_utils.py @@ -1,15 +1,17 @@ """Contains utilities related to the :func:`@task `.""" + from __future__ import annotations import functools import inspect from collections import defaultdict from types import BuiltinFunctionType +from typing import TYPE_CHECKING from typing import Any from typing import Callable -from typing import TYPE_CHECKING import attrs + from _pytask.console import get_file from _pytask.mark import Mark from _pytask.models import CollectionMetadata diff --git a/src/_pytask/traceback.py b/src/_pytask/traceback.py index e139f516..5282d7e3 100644 --- a/src/_pytask/traceback.py +++ b/src/_pytask/traceback.py @@ -1,25 +1,27 @@ """Process tracebacks.""" + from __future__ import annotations from pathlib import Path from types import TracebackType +from typing import TYPE_CHECKING from typing import ClassVar from typing import Generator from typing import Tuple from typing import Type -from typing import TYPE_CHECKING from typing import Union -import _pytask import pluggy -from _pytask.outcomes import Exit -from _pytask.tree_util import TREE_UTIL_LIB_DIRECTORY from attrs import define from rich.traceback import Traceback as RichTraceback +import _pytask +from _pytask.outcomes import Exit +from _pytask.tree_util import TREE_UTIL_LIB_DIRECTORY + if TYPE_CHECKING: - from rich.console import ConsoleOptions from rich.console import Console + from rich.console import ConsoleOptions from rich.console import RenderResult from typing_extensions import TypeAlias diff --git a/src/_pytask/tree_util.py b/src/_pytask/tree_util.py index 585e1183..43adbfbd 100644 --- a/src/_pytask/tree_util.py +++ b/src/_pytask/tree_util.py @@ -1,4 +1,5 @@ """Contains code for tree utilities.""" + from __future__ import annotations import functools @@ -12,7 +13,6 @@ from optree import tree_map_with_path as _optree_tree_map_with_path from optree import tree_structure as _optree_tree_structure - __all__ = [ "PyTree", "TREE_UTIL_LIB_DIRECTORY", diff --git a/src/_pytask/typing.py b/src/_pytask/typing.py index 5d14d8e8..770f820b 100644 --- a/src/_pytask/typing.py +++ b/src/_pytask/typing.py @@ -2,10 +2,10 @@ import functools from enum import Enum +from typing import TYPE_CHECKING from typing import Any from typing import Final from typing import Literal -from typing import TYPE_CHECKING from attrs import define diff --git a/src/_pytask/warnings.py b/src/_pytask/warnings.py index fb09eea9..b5986c84 100644 --- a/src/_pytask/warnings.py +++ b/src/_pytask/warnings.py @@ -1,28 +1,31 @@ """Contains code for capturing warnings.""" + from __future__ import annotations from collections import defaultdict +from typing import TYPE_CHECKING from typing import Any from typing import Generator -from typing import TYPE_CHECKING import click +from attrs import define +from rich.padding import Padding +from rich.panel import Panel + from _pytask.console import console from _pytask.pluginmanager import hookimpl +from _pytask.warnings_utils import WarningReport from _pytask.warnings_utils import catch_warnings_for_item from _pytask.warnings_utils import parse_filterwarnings -from _pytask.warnings_utils import WarningReport -from attrs import define -from rich.padding import Padding -from rich.panel import Panel if TYPE_CHECKING: from rich.console import Console - from _pytask.node_protocols import PTask from rich.console import ConsoleOptions - from _pytask.session import Session from rich.console import RenderResult + from _pytask.node_protocols import PTask + from _pytask.session import Session + @hookimpl def pytask_extend_command_line_interface(cli: click.Group) -> None: diff --git a/src/_pytask/warnings_utils.py b/src/_pytask/warnings_utils.py index f2f94134..c4502510 100644 --- a/src/_pytask/warnings_utils.py +++ b/src/_pytask/warnings_utils.py @@ -1,4 +1,5 @@ """Contains utility functions for warnings.""" + from __future__ import annotations import functools @@ -6,15 +7,14 @@ import textwrap import warnings from contextlib import contextmanager -from typing import cast +from typing import TYPE_CHECKING from typing import Generator from typing import NamedTuple -from typing import TYPE_CHECKING +from typing import cast from _pytask.mark_utils import get_marks from _pytask.outcomes import Exit - if TYPE_CHECKING: from _pytask.node_protocols import PTask from _pytask.session import Session diff --git a/src/pytask/__init__.py b/src/pytask/__init__.py index d8ed8131..5e5bdb2a 100644 --- a/src/pytask/__init__.py +++ b/src/pytask/__init__.py @@ -1,11 +1,14 @@ """Contains the main namespace for pytask.""" -from __future__ import annotations + +from __future__ import annotations # noqa: I001 from _pytask import __version__ from _pytask._hashlib import hash_value from _pytask.build import build from _pytask.capture_utils import CaptureMethod from _pytask.capture_utils import ShowCapture + + from _pytask.click import ColoredCommand from _pytask.click import ColoredGroup from _pytask.click import EnumChoice @@ -17,9 +20,9 @@ from _pytask.dag_command import build_dag from _pytask.data_catalog import DataCatalog from _pytask.database_utils import BaseTable -from _pytask.database_utils import create_database from _pytask.database_utils import DatabaseSession from _pytask.database_utils import State +from _pytask.database_utils import create_database from _pytask.exceptions import CollectionError from _pytask.exceptions import ConfigurationError from _pytask.exceptions import ExecutionError @@ -27,8 +30,8 @@ from _pytask.exceptions import NodeNotFoundError from _pytask.exceptions import PytaskError from _pytask.exceptions import ResolvingDependenciesError -from _pytask.mark import Mark from _pytask.mark import MARK_GEN as mark # noqa: N811 +from _pytask.mark import Mark from _pytask.mark import MarkDecorator from _pytask.mark import MarkGenerator from _pytask.mark_utils import get_all_marks @@ -48,7 +51,6 @@ from _pytask.nodes import Task from _pytask.nodes import TaskWithoutPath from _pytask.outcomes import CollectionOutcome -from _pytask.outcomes import count_outcomes from _pytask.outcomes import Exit from _pytask.outcomes import ExitCode from _pytask.outcomes import Persisted @@ -56,6 +58,7 @@ from _pytask.outcomes import SkippedAncestorFailed from _pytask.outcomes import SkippedUnchanged from _pytask.outcomes import TaskOutcome +from _pytask.outcomes import count_outcomes from _pytask.pluginmanager import get_plugin_manager from _pytask.pluginmanager import hookimpl from _pytask.pluginmanager import storage @@ -65,18 +68,18 @@ from _pytask.reports import ExecutionReport from _pytask.session import Session from _pytask.task_utils import task -from _pytask.traceback import remove_internal_traceback_frames_from_exc_info from _pytask.traceback import Traceback -from _pytask.typing import is_task_function +from _pytask.traceback import remove_internal_traceback_frames_from_exc_info from _pytask.typing import Product +from _pytask.typing import is_task_function +from _pytask.warnings_utils import WarningReport from _pytask.warnings_utils import parse_warning_filter from _pytask.warnings_utils import warning_record_to_str -from _pytask.warnings_utils import WarningReport # _pytask.cli needs to be imported last because it triggers extending the cli and # therefore loading plugins which will attempt to import modules that might only be # partially initialized. Maybe not here, but definitely for plugins. -from _pytask.cli import cli # noreorder +from _pytask.cli import cli __all__ = [ "BaseTable", diff --git a/src/pytask/__main__.py b/src/pytask/__main__.py index 851341b9..adfb4e6c 100644 --- a/src/pytask/__main__.py +++ b/src/pytask/__main__.py @@ -1,10 +1,10 @@ """The pytask entry-point.""" + from __future__ import annotations import sys import pytask - if __name__ == "__main__": sys.exit(pytask.cli()) diff --git a/src/pytask/path.py b/src/pytask/path.py index 4fbd6c64..6c32c3d4 100644 --- a/src/pytask/path.py +++ b/src/pytask/path.py @@ -1,8 +1,8 @@ """Publishes functions of :mod:`_pytask.tree_util`.""" + from __future__ import annotations from _pytask.path import hash_path from _pytask.path import import_path - __all__ = ["hash_path", "import_path"] diff --git a/src/pytask/tree_util.py b/src/pytask/tree_util.py index c3658f35..d144a6c8 100644 --- a/src/pytask/tree_util.py +++ b/src/pytask/tree_util.py @@ -1,4 +1,5 @@ """Publishes functions of :mod:`_pytask.tree_util`.""" + from __future__ import annotations from _pytask.tree_util import PyTree @@ -8,7 +9,6 @@ from _pytask.tree_util import tree_map_with_path from _pytask.tree_util import tree_structure - __all__ = [ "PyTree", "tree_flatten_with_path", diff --git a/tests/test_build.py b/tests/test_build.py index 526079bb..3075cab6 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -3,8 +3,8 @@ import textwrap import pytest -from pytask import cli from pytask import ExitCode +from pytask import cli @pytest.mark.end_to_end() diff --git a/tests/test_cache.py b/tests/test_cache.py index 74ac2a67..218120f3 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -2,8 +2,8 @@ import inspect -from _pytask.cache import _make_memoize_key from _pytask.cache import Cache +from _pytask.cache import _make_memoize_key def test_cache(): diff --git a/tests/test_capture.py b/tests/test_capture.py index b78f93fe..09a6ad1f 100644 --- a/tests/test_capture.py +++ b/tests/test_capture.py @@ -13,13 +13,13 @@ import pytest from _pytask import capture -from _pytask.capture import _get_multicapture from _pytask.capture import CaptureManager from _pytask.capture import CaptureResult from _pytask.capture import MultiCapture +from _pytask.capture import _get_multicapture from pytask import CaptureMethod -from pytask import cli from pytask import ExitCode +from pytask import cli @pytest.mark.end_to_end() @@ -568,13 +568,13 @@ def test_simple_resume_suspend(self): pytest.raises(AssertionError, cap.suspend) assert repr(cap) == ( - "".format( + "".format( # noqa: UP032 cap.targetfd_save, cap.tmpfile ) ) # Should not crash with missing "_old". assert repr(cap.syscapture) == ( - " _state='done' tmpfile={!r}>".format( + " _state='done' tmpfile={!r}>".format( # noqa: UP032 cap.syscapture.tmpfile ) ) diff --git a/tests/test_clean.py b/tests/test_clean.py index 0dd39611..abde77c5 100644 --- a/tests/test_clean.py +++ b/tests/test_clean.py @@ -7,11 +7,10 @@ import pytest from _pytask.git import init_repo -from pytask import cli from pytask import ExitCode +from pytask import cli from pytask import storage - _PROJECT_TASK = """ import pytask from pathlib import Path diff --git a/tests/test_cli.py b/tests/test_cli.py index e93938d1..0cde7b97 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -3,9 +3,9 @@ import subprocess import pytest +from pytask import ExitCode from pytask import __version__ from pytask import cli -from pytask import ExitCode @pytest.mark.end_to_end() diff --git a/tests/test_click.py b/tests/test_click.py index 2f005524..ec01e758 100644 --- a/tests/test_click.py +++ b/tests/test_click.py @@ -4,8 +4,8 @@ import click import pytest -from pytask import cli from pytask import EnumChoice +from pytask import cli @pytest.mark.end_to_end() @@ -47,8 +47,7 @@ class Method(enum.Enum): @click.command() @click.option("--method", type=EnumChoice(Method)) - def test(): - ... + def test(): ... result = runner.invoke(test, ["--method", "third"]) diff --git a/tests/test_collect.py b/tests/test_collect.py index e9c928a8..5ef6f6c0 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -8,13 +8,13 @@ import pytest from _pytask.collect import _find_shortest_uniquely_identifiable_name_for_tasks from _pytask.collect import pytask_collect_node -from pytask import build -from pytask import cli from pytask import CollectionOutcome from pytask import ExitCode from pytask import NodeInfo from pytask import Session from pytask import Task +from pytask import build +from pytask import cli @pytest.mark.end_to_end() diff --git a/tests/test_collect_command.py b/tests/test_collect_command.py index 66cf9b97..e1400013 100644 --- a/tests/test_collect_command.py +++ b/tests/test_collect_command.py @@ -10,10 +10,10 @@ from _pytask.collect_command import _find_common_ancestor_of_all_nodes from _pytask.collect_command import _print_collected_tasks from attrs import define -from pytask import cli from pytask import ExitCode from pytask import PathNode from pytask import Task +from pytask import cli @pytest.mark.end_to_end() @@ -317,8 +317,7 @@ def task_example_2(path=Path("in_2.txt"), produces=Path("out_2.txt")): ... class Node: path: Path - def state(self): - ... + def state(self): ... def function(depends_on, produces): # noqa: ARG001 diff --git a/tests/test_config.py b/tests/test_config.py index 2eb5300d..3874e1ac 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -6,9 +6,9 @@ import textwrap import pytest +from pytask import ExitCode from pytask import build from pytask import cli -from pytask import ExitCode @pytest.mark.end_to_end() diff --git a/tests/test_console.py b/tests/test_console.py index b2d4dd8d..f8dc4162 100644 --- a/tests/test_console.py +++ b/tests/test_console.py @@ -14,11 +14,11 @@ from _pytask.console import get_file from _pytask.console import render_to_string from pytask import CollectionOutcome -from pytask import console from pytask import PathNode from pytask import PythonNode from pytask import Task from pytask import TaskOutcome +from pytask import console from rich.console import Console from rich.style import Style from rich.text import Span @@ -27,8 +27,7 @@ from tests._test_console_helpers import empty_decorator -def task_func(): - ... +def task_func(): ... _SOURCE_LINE_TASK_FUNC = inspect.getsourcelines(task_func)[1] diff --git a/tests/test_dag.py b/tests/test_dag.py index f801b7cd..05044aa5 100644 --- a/tests/test_dag.py +++ b/tests/test_dag.py @@ -6,12 +6,12 @@ import pytest from _pytask.dag import pytask_dag_create_dag -from pytask import build -from pytask import cli from pytask import ExitCode from pytask import PathNode from pytask import Session from pytask import Task +from pytask import build +from pytask import cli @pytest.mark.unit() diff --git a/tests/test_dag_command.py b/tests/test_dag_command.py index cf0113b7..ef05c82b 100644 --- a/tests/test_dag_command.py +++ b/tests/test_dag_command.py @@ -6,8 +6,8 @@ import pytest from _pytask.dag_command import _RankDirection -from pytask import cli from pytask import ExitCode +from pytask import cli try: import pygraphviz # noqa: F401 diff --git a/tests/test_dag_utils.py b/tests/test_dag_utils.py index 6226783a..2692b02d 100644 --- a/tests/test_dag_utils.py +++ b/tests/test_dag_utils.py @@ -5,11 +5,11 @@ import networkx as nx import pytest +from _pytask.dag_utils import TopologicalSorter from _pytask.dag_utils import _extract_priorities_from_tasks from _pytask.dag_utils import descending_tasks from _pytask.dag_utils import node_and_neighbors from _pytask.dag_utils import task_and_descending_tasks -from _pytask.dag_utils import TopologicalSorter from pytask import Mark from pytask import Task diff --git a/tests/test_data_catalog.py b/tests/test_data_catalog.py index a060e150..b70acf35 100644 --- a/tests/test_data_catalog.py +++ b/tests/test_data_catalog.py @@ -5,13 +5,12 @@ from pathlib import Path import pytest -from pytask import cli from pytask import DataCatalog from pytask import ExitCode from pytask import PathNode from pytask import PickleNode from pytask import PythonNode - +from pytask import cli try: import pexpect diff --git a/tests/test_database.py b/tests/test_database.py index 82f6531d..0745a999 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -3,12 +3,12 @@ import textwrap import pytest -from pytask import build -from pytask import cli -from pytask import create_database from pytask import DatabaseSession from pytask import ExitCode from pytask import State +from pytask import build +from pytask import cli +from pytask import create_database from pytask.path import hash_path from sqlalchemy.engine import make_url diff --git a/tests/test_debugging.py b/tests/test_debugging.py index 83e96743..3df5b91e 100644 --- a/tests/test_debugging.py +++ b/tests/test_debugging.py @@ -9,9 +9,8 @@ import click import pytest from _pytask.debugging import _pdbcls_callback -from pytask import cli from pytask import ExitCode - +from pytask import cli try: import pexpect diff --git a/tests/test_dry_run.py b/tests/test_dry_run.py index 1c0e31dc..e7047dde 100644 --- a/tests/test_dry_run.py +++ b/tests/test_dry_run.py @@ -3,8 +3,8 @@ import textwrap import pytest -from pytask import cli from pytask import ExitCode +from pytask import cli @pytest.mark.end_to_end() diff --git a/tests/test_execute.py b/tests/test_execute.py index db1834f7..0bfb2613 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -11,14 +11,14 @@ import pytask import pytest -from pytask import build from pytask import CaptureMethod -from pytask import cli from pytask import ExitCode from pytask import NodeNotFoundError from pytask import PathNode from pytask import TaskOutcome from pytask import TaskWithoutPath +from pytask import build +from pytask import cli @pytest.mark.xfail(sys.platform == "win32", reason="See #293.") diff --git a/tests/test_ignore.py b/tests/test_ignore.py index 48c5af53..ab1e7c5c 100644 --- a/tests/test_ignore.py +++ b/tests/test_ignore.py @@ -5,8 +5,8 @@ import pytest from _pytask.collect import pytask_ignore_collect from _pytask.config import _IGNORED_FOLDERS -from pytask import build from pytask import ExitCode +from pytask import build @pytest.mark.end_to_end() diff --git a/tests/test_live.py b/tests/test_live.py index 65760fc5..1d354bc6 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -6,11 +6,11 @@ import pytest from _pytask.live import LiveExecution from _pytask.live import LiveManager -from pytask import cli from pytask import ExecutionReport from pytask import ExitCode from pytask import Task from pytask import TaskOutcome +from pytask import cli @pytest.mark.end_to_end() diff --git a/tests/test_logging.py b/tests/test_logging.py index 972716ff..6afc4f1d 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -8,9 +8,9 @@ from _pytask.logging import _format_plugin_names_and_versions from _pytask.logging import _humanize_time from _pytask.logging import pytask_log_session_footer -from pytask import cli from pytask import ExitCode from pytask import TaskOutcome +from pytask import cli class DummyDist(NamedTuple): diff --git a/tests/test_mark.py b/tests/test_mark.py index d9c961c5..d42d2ffd 100644 --- a/tests/test_mark.py +++ b/tests/test_mark.py @@ -5,10 +5,10 @@ import pytask import pytest -from pytask import build -from pytask import cli from pytask import ExitCode from pytask import MarkGenerator +from pytask import build +from pytask import cli @pytest.mark.unit() diff --git a/tests/test_mark_cli.py b/tests/test_mark_cli.py index 04949a5e..aa9d3b13 100644 --- a/tests/test_mark_cli.py +++ b/tests/test_mark_cli.py @@ -3,9 +3,9 @@ import textwrap import pytest +from pytask import ExitCode from pytask import build from pytask import cli -from pytask import ExitCode @pytest.mark.end_to_end() diff --git a/tests/test_mark_utils.py b/tests/test_mark_utils.py index f0d82d31..94af5c1d 100644 --- a/tests/test_mark_utils.py +++ b/tests/test_mark_utils.py @@ -5,12 +5,12 @@ import pytask import pytest from pytask import CollectionMetadata +from pytask import Task from pytask import get_all_marks from pytask import get_marks from pytask import has_mark from pytask import remove_marks from pytask import set_marks -from pytask import Task @pytest.mark.unit() @@ -51,8 +51,7 @@ def test_get_all_marks_from_task(markers, expected): ], ) def test_get_all_marks_from_obj(markers, expected): - def func(): - ... + def func(): ... if markers is not None: func.pytask_meta = CollectionMetadata(markers=markers) @@ -103,8 +102,7 @@ def test_get_marks_from_task(markers, marker_name, expected): ], ) def test_get_marks_from_obj(markers, marker_name, expected): - def func(): - ... + def func(): ... if markers is not None: func.pytask_meta = CollectionMetadata(markers=markers) @@ -151,8 +149,7 @@ def test_has_mark_for_task(markers, marker_name, expected): ], ) def test_has_mark(markers, marker_name, expected): - def func(): - ... + def func(): ... if markers is not None: func.pytask_meta = CollectionMetadata(markers=markers) @@ -212,8 +209,7 @@ def test_remove_marks_from_task( def test_remove_marks_from_func( markers, marker_name, expected_markers, expected_others ): - def func(): - ... + def func(): ... if markers is not None: func.pytask_meta = CollectionMetadata(markers=markers) @@ -249,8 +245,7 @@ def test_set_marks_to_task(markers): ], ) def test_set_marks_to_obj(markers): - def func(): - ... + def func(): ... result = set_marks(func, markers) assert result.pytask_meta.markers == markers diff --git a/tests/test_node_protocols.py b/tests/test_node_protocols.py index 9677f363..4ab4c993 100644 --- a/tests/test_node_protocols.py +++ b/tests/test_node_protocols.py @@ -4,8 +4,8 @@ import textwrap import pytest -from pytask import cli from pytask import ExitCode +from pytask import cli @pytest.mark.end_to_end() diff --git a/tests/test_outcomes.py b/tests/test_outcomes.py index 5253ca21..cb59f4f4 100644 --- a/tests/test_outcomes.py +++ b/tests/test_outcomes.py @@ -3,9 +3,9 @@ import pytest from pytask import CollectionOutcome from pytask import CollectionReport -from pytask import count_outcomes from pytask import ExecutionReport from pytask import TaskOutcome +from pytask import count_outcomes @pytest.mark.unit() diff --git a/tests/test_persist.py b/tests/test_persist.py index 8909b405..46580fb4 100644 --- a/tests/test_persist.py +++ b/tests/test_persist.py @@ -4,14 +4,14 @@ import pytest from _pytask.persist import pytask_execute_task_process_report -from pytask import build -from pytask import create_database from pytask import DatabaseSession from pytask import ExitCode from pytask import Persisted from pytask import SkippedUnchanged from pytask import State from pytask import TaskOutcome +from pytask import build +from pytask import create_database from pytask.path import hash_path from tests.conftest import restore_sys_path_and_module_after_test_execution diff --git a/tests/test_profile.py b/tests/test_profile.py index 2bd8c031..fd5065d5 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -4,12 +4,12 @@ import pytest from _pytask.profile import _to_human_readable_size -from pytask import build -from pytask import cli -from pytask import create_database from pytask import DatabaseSession from pytask import ExitCode from pytask import Runtime +from pytask import build +from pytask import cli +from pytask import create_database @pytest.mark.end_to_end() diff --git a/tests/test_shared.py b/tests/test_shared.py index 22cd5cb2..6408950a 100644 --- a/tests/test_shared.py +++ b/tests/test_shared.py @@ -6,9 +6,9 @@ import pytest from _pytask.shared import convert_to_enum from _pytask.shared import find_duplicates -from pytask import build from pytask import ExitCode from pytask import ShowCapture +from pytask import build @pytest.mark.unit() diff --git a/tests/test_skipping.py b/tests/test_skipping.py index fbe0606d..6f3a3298 100644 --- a/tests/test_skipping.py +++ b/tests/test_skipping.py @@ -6,8 +6,6 @@ import pytest from _pytask.skipping import pytask_execute_task_setup -from pytask import build -from pytask import cli from pytask import ExitCode from pytask import Mark from pytask import Session @@ -16,6 +14,8 @@ from pytask import SkippedUnchanged from pytask import Task from pytask import TaskOutcome +from pytask import build +from pytask import cli class DummyClass: diff --git a/tests/test_task.py b/tests/test_task.py index 57365896..bd82d41c 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -4,9 +4,9 @@ import textwrap import pytest +from pytask import ExitCode from pytask import build from pytask import cli -from pytask import ExitCode @pytest.mark.end_to_end() diff --git a/tests/test_traceback.py b/tests/test_traceback.py index c626d0c7..d636f770 100644 --- a/tests/test_traceback.py +++ b/tests/test_traceback.py @@ -4,10 +4,10 @@ import pytest from _pytask.console import render_to_string -from pytask import cli -from pytask import console from pytask import ExitCode from pytask import Traceback +from pytask import cli +from pytask import console @pytest.mark.end_to_end() diff --git a/tests/test_tree_util.py b/tests/test_tree_util.py index 7b9be7a9..0aca6bfe 100644 --- a/tests/test_tree_util.py +++ b/tests/test_tree_util.py @@ -1,12 +1,13 @@ """This module contains tests for tree_util and flexible dependencies and products.""" + from __future__ import annotations import textwrap import pytest +from pytask import ExitCode from pytask import build from pytask import cli -from pytask import ExitCode from pytask.tree_util import tree_map from pytask.tree_util import tree_structure diff --git a/tests/test_typing.py b/tests/test_typing.py index 1a084c7f..e926cfda 100644 --- a/tests/test_typing.py +++ b/tests/test_typing.py @@ -8,8 +8,7 @@ @pytest.mark.unit() def test_is_task_function(): - def func(): - ... + def func(): ... assert is_task_function(func) diff --git a/tests/test_warnings.py b/tests/test_warnings.py index 90233aba..4535c6f6 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -5,9 +5,9 @@ import textwrap import pytest +from pytask import ExitCode from pytask import build from pytask import cli -from pytask import ExitCode @pytest.mark.end_to_end()