Skip to content

Commit

Permalink
0.9.3 (#164)
Browse files Browse the repository at this point in the history
* πŸ› Set logging.lastResort to null handler

* ✨ Allow to assign process directly to proc groups

* πŸ”§ Change progress bar description length to 24

* πŸ”– 0.9.3
  • Loading branch information
pwwang authored Apr 15, 2023
1 parent 9ca1c25 commit 51769ec
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 15 deletions.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.9.3

- πŸ› Set logging.lastResort to null handler
- ✨ Allow to assign process directly to proc groups
- πŸ”§ Change progress bar description length to 24

## 0.9.2

- 🎨 Rename to main plugin to core
Expand Down
12 changes: 4 additions & 8 deletions pipen/procgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def _load_runtime_procs(self):
for name, attr in self.__class__.__dict__.items():
if isinstance(attr, cached_property):
getattr(self, name)
elif isinstance(attr, type) and issubclass(attr, Proc):
self.add_proc(attr)

def add_proc(
self_or_method: ProcGroup | Callable[[ProcGroup], Type[Proc]],
Expand Down Expand Up @@ -142,14 +144,8 @@ def wrapper(self):
if proc is None:
return None

if (
not isinstance(proc, Proc)
and (not isinstance(proc, type) or not issubclass(proc, Proc))
):
raise ValueError(
f"`{proc}` is not a process "
"(either a subclass or an instance of Proc)"
)
if (not isinstance(proc, type) or not issubclass(proc, Proc)):
raise ValueError(f"`{proc}` is not a Proc subclass")

proc.__meta__["procgroup"] = self
if not proc.requires:
Expand Down
2 changes: 1 addition & 1 deletion pipen/progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# [12/02/20 12:44:06] I core
# pipeline: 100%|
# | desc_len |
PBAR_DESC_LEN = 23
PBAR_DESC_LEN = 24


class ProcPBar:
Expand Down
2 changes: 1 addition & 1 deletion pipen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def _render_buffer(self, buffer: Iterable[Segment]) -> str:
return out.rstrip() + "\n"


logging.lastResort = logging.NullHandler() # type: ignore
logger_console = RichConsole()

_logger_handler = RichHandler(
show_path=False,
show_level=True,
Expand Down
2 changes: 1 addition & 1 deletion pipen/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Provide version of pipen"""

__version__ = "0.9.2"
__version__ = "0.9.3"
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "pipen"
version = "0.9.2"
version = "0.9.3"
description = "A pipeline framework for python"
authors = [ "pwwang <[email protected]>",]
license = "MIT"
Expand Down
14 changes: 14 additions & 0 deletions tests/test_procgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,17 @@ class PG(ProcGroup):
@pg.add_proc
class opts(Proc):
...


def test_add_proc_directly():
class P1(Proc):
...

class PG(ProcGroup):
p1 = P1

pg = PG()

assert pg.p1 is P1
assert pg.procs == {"P1": P1}
assert pg.starts == [P1]

0 comments on commit 51769ec

Please sign in to comment.