Skip to content

Commit 47e073e

Browse files
authored
Refactor pybaum to _pytask.tree_util. (#395)
1 parent 2279aff commit 47e073e

File tree

9 files changed

+32
-12
lines changed

9 files changed

+32
-12
lines changed

docs/source/changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
1212
is not present.
1313
- {pull}`387` replaces pony with sqlalchemy.
1414
- {pull}`391` removes `@pytask.mark.parametrize`.
15+
- {pull}`394` allows to add products with {obj}`typing.Annotation` and
16+
{obj}`~pytask.Product`.
17+
- {pull}`395` refactors all occurrences of pybaum to {mod}`_pytask.tree_util`.
1518

1619
## 0.3.2 - 2023-06-07
1720

src/_pytask/clean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
from _pytask.session import Session
3030
from _pytask.shared import to_list
3131
from _pytask.traceback import render_exc_info
32+
from _pytask.tree_util import tree_just_yield
3233
from attrs import define
33-
from pybaum.tree_util import tree_just_yield
3434

3535

3636
if TYPE_CHECKING:

src/_pytask/collect_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from _pytask.path import relative_to
2727
from _pytask.pluginmanager import get_plugin_manager
2828
from _pytask.session import Session
29-
from pybaum.tree_util import tree_just_flatten
29+
from _pytask.tree_util import tree_just_flatten
3030
from rich.text import Text
3131
from rich.tree import Tree
3232

src/_pytask/collect_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
from _pytask.nodes import PythonNode
2020
from _pytask.shared import find_duplicates
2121
from _pytask.task_utils import parse_keyword_arguments_from_signature_defaults
22+
from _pytask.tree_util import tree_map
2223
from attrs import define
2324
from attrs import field
24-
from pybaum.tree_util import tree_map
2525
from typing_extensions import Annotated
2626
from typing_extensions import get_origin
2727

src/_pytask/dag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from _pytask.shared import reduce_names_of_multiple_nodes
3232
from _pytask.shared import reduce_node_name
3333
from _pytask.traceback import render_exc_info
34-
from pybaum import tree_map
34+
from _pytask.tree_util import tree_map
3535
from rich.text import Text
3636
from rich.tree import Tree
3737

src/_pytask/execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from _pytask.traceback import format_exception_without_traceback
3434
from _pytask.traceback import remove_traceback_from_exc_info
3535
from _pytask.traceback import render_exc_info
36-
from pybaum.tree_util import tree_map
36+
from _pytask.tree_util import tree_map
3737
from rich.text import Text
3838

3939

src/_pytask/traceback.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import _pytask
1212
import pluggy
13-
import pybaum
13+
from _pytask.tree_util import TREE_UTIL_LIB_DIRECTORY
1414
from rich.traceback import Traceback
1515

1616

@@ -23,7 +23,6 @@
2323

2424

2525
_PLUGGY_DIRECTORY = Path(pluggy.__file__).parent
26-
_PYBAUM_DIRECTORY = Path(pybaum.__file__).parent
2726
_PYTASK_DIRECTORY = Path(_pytask.__file__).parent
2827

2928

@@ -93,7 +92,7 @@ def _is_internal_or_hidden_traceback_frame(
9392
path = Path(frame.tb_frame.f_code.co_filename)
9493
return any(
9594
root in path.parents
96-
for root in (_PLUGGY_DIRECTORY, _PYBAUM_DIRECTORY, _PYTASK_DIRECTORY)
95+
for root in (_PLUGGY_DIRECTORY, TREE_UTIL_LIB_DIRECTORY, _PYTASK_DIRECTORY)
9796
)
9897

9998

src/_pytask/tree_util.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from __future__ import annotations
2+
3+
from pathlib import Path
4+
5+
import pybaum
6+
from pybaum.tree_util import tree_just_flatten
7+
from pybaum.tree_util import tree_just_yield
8+
from pybaum.tree_util import tree_map
9+
10+
11+
__all__ = [
12+
"tree_just_flatten",
13+
"tree_map",
14+
"tree_just_yield",
15+
"TREE_UTIL_LIB_DIRECTORY",
16+
]
17+
18+
TREE_UTIL_LIB_DIRECTORY = Path(pybaum.__file__).parent

tests/test_pybaum.py renamed to tests/test_tree_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
"""This module contains tests for pybaum and flexible dependencies and products."""
1+
"""This module contains tests for tree_util and flexible dependencies and products."""
22
from __future__ import annotations
33

44
import textwrap
55

66
import pytest
77
from _pytask.outcomes import ExitCode
8-
from pybaum import tree_map
8+
from _pytask.tree_util import tree_map
99
from pytask import cli
1010
from pytask import main
1111

@@ -55,11 +55,11 @@ def task_example():
5555

5656

5757
@pytest.mark.end_to_end()
58-
def test_profile_with_pybaum(tmp_path, runner):
58+
def test_profile_with_pytree(tmp_path, runner):
5959
source = """
6060
import time
6161
import pytask
62-
from pybaum.tree_util import tree_just_flatten
62+
from _pytask.tree_util import tree_just_flatten
6363
6464
@pytask.mark.produces([{"out_1": "out_1.txt"}, {"out_2": "out_2.txt"}])
6565
def task_example(produces):

0 commit comments

Comments
 (0)