diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4297698..9aca857 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,7 +61,7 @@ repos: attrs, cloudpickle, loky, - pytask>=0.4.5, + "git+https://github.com/pytask-dev/pytask.git@main", rich, types-click, types-setuptools, diff --git a/CHANGES.md b/CHANGES.md index 379b7f2..0f53184 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,9 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/) releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and [Anaconda.org](https://anaconda.org/conda-forge/pytask-parallel). -## 0.4.2 - 2024-xx-xx +## 0.5.0 - 2024-xx-xx - {pull}`85` simplifies code since loky is a dependency. +- {pull}`88` updates handling `Traceback`. - {pull}`89` restructures the package. ## 0.4.1 - 2024-01-12 diff --git a/src/pytask_parallel/processes.py b/src/pytask_parallel/processes.py index b9541ba..9f139c1 100644 --- a/src/pytask_parallel/processes.py +++ b/src/pytask_parallel/processes.py @@ -15,16 +15,15 @@ from pytask import PTask from pytask import PythonNode from pytask import Session +from pytask import Traceback from pytask import WarningReport from pytask import console from pytask import get_marks from pytask import hookimpl from pytask import parse_warning_filter -from pytask import remove_internal_traceback_frames_from_exc_info from pytask import warning_record_to_str from pytask.tree_util import PyTree from pytask.tree_util import tree_map -from rich.traceback import Traceback from pytask_parallel.utils import create_kwargs_for_task from pytask_parallel.utils import handle_task_function_return @@ -161,8 +160,7 @@ def _process_exception( console_options: ConsoleOptions, ) -> tuple[type[BaseException], BaseException, str]: """Process the exception and convert the traceback to a string.""" - exc_info = remove_internal_traceback_frames_from_exc_info(exc_info) - traceback = Traceback.from_exception(*exc_info, show_locals=show_locals) + traceback = Traceback(exc_info, show_locals=show_locals) segments = console.render(traceback, options=console_options) text = "".join(segment.text for segment in segments) return (*exc_info[:2], text) diff --git a/tests/test_execute.py b/tests/test_execute.py index a99a0de..410572a 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -172,10 +172,11 @@ def test_collect_warnings_from_parallelized_tasks(runner, tmp_path, parallel_bac source = """ from pytask import task import warnings + from pathlib import Path for i in range(2): - @task(id=str(i), kwargs={"produces": f"{i}.txt"}) + @task(id=str(i), kwargs={"produces": Path(f"{i}.txt")}) def task_example(produces): warnings.warn("This is a warning.") produces.touch() diff --git a/tox.ini b/tox.ini index c23cf3c..0be302e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,5 +7,7 @@ package = editable [testenv:test] extras = test +deps = + git+https://github.com/pytask-dev/pytask.git@main commands = pytest --nbmake {posargs}