Skip to content

Commit f1049a5

Browse files
authored
Update handling of Traceback. (#88)
1 parent 777ab26 commit f1049a5

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ repos:
6161
attrs,
6262
cloudpickle,
6363
loky,
64-
pytask>=0.4.5,
64+
"git+https://github.com/pytask-dev/pytask.git@main",
6565
rich,
6666
types-click,
6767
types-setuptools,

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
55
releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and
66
[Anaconda.org](https://anaconda.org/conda-forge/pytask-parallel).
77

8-
## 0.4.2 - 2024-xx-xx
8+
## 0.5.0 - 2024-xx-xx
99

1010
- {pull}`85` simplifies code since loky is a dependency.
11+
- {pull}`88` updates handling `Traceback`.
1112
- {pull}`89` restructures the package.
1213

1314
## 0.4.1 - 2024-01-12

src/pytask_parallel/processes.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515
from pytask import PTask
1616
from pytask import PythonNode
1717
from pytask import Session
18+
from pytask import Traceback
1819
from pytask import WarningReport
1920
from pytask import console
2021
from pytask import get_marks
2122
from pytask import hookimpl
2223
from pytask import parse_warning_filter
23-
from pytask import remove_internal_traceback_frames_from_exc_info
2424
from pytask import warning_record_to_str
2525
from pytask.tree_util import PyTree
2626
from pytask.tree_util import tree_map
27-
from rich.traceback import Traceback
2827

2928
from pytask_parallel.utils import create_kwargs_for_task
3029
from pytask_parallel.utils import handle_task_function_return
@@ -161,8 +160,7 @@ def _process_exception(
161160
console_options: ConsoleOptions,
162161
) -> tuple[type[BaseException], BaseException, str]:
163162
"""Process the exception and convert the traceback to a string."""
164-
exc_info = remove_internal_traceback_frames_from_exc_info(exc_info)
165-
traceback = Traceback.from_exception(*exc_info, show_locals=show_locals)
163+
traceback = Traceback(exc_info, show_locals=show_locals)
166164
segments = console.render(traceback, options=console_options)
167165
text = "".join(segment.text for segment in segments)
168166
return (*exc_info[:2], text)

tests/test_execute.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ def test_collect_warnings_from_parallelized_tasks(runner, tmp_path, parallel_bac
172172
source = """
173173
from pytask import task
174174
import warnings
175+
from pathlib import Path
175176
176177
for i in range(2):
177178
178-
@task(id=str(i), kwargs={"produces": f"{i}.txt"})
179+
@task(id=str(i), kwargs={"produces": Path(f"{i}.txt")})
179180
def task_example(produces):
180181
warnings.warn("This is a warning.")
181182
produces.touch()

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ package = editable
77

88
[testenv:test]
99
extras = test
10+
deps =
11+
git+https://github.com/pytask-dev/pytask.git@main
1012
commands =
1113
pytest --nbmake {posargs}

0 commit comments

Comments
 (0)