Skip to content

Commit

Permalink
0.9.4 (#165)
Browse files Browse the repository at this point in the history
* πŸ› Use class name as pipeline name

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

## 0.9.4

- πŸ› Use class name as pipeline name

## 0.9.3

- πŸ› Set logging.lastResort to null handler
Expand Down
13 changes: 10 additions & 3 deletions pipen/pipen.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,17 @@ def __init__(
self.name = name
elif self.__class__.name is not None:
self.name = self.__class__.name
elif self.__class__.__name__ != "Pipen":
self.name = self.__class__.__name__
else:
try:
self.name = varname()
except VarnameException:
self.name = f"pipen-{self.__class__.PIPELINE_COUNT}"
if self.__class__.PIPELINE_COUNT == 0:
self.name = self.__class__.__name__
else:
self.name = (
f"{self.__class__.__name__}-"
f"{self.__class__.PIPELINE_COUNT}"
)

if not is_valid_name(self.name):
raise PipenOrProcNameError(
Expand Down Expand Up @@ -154,6 +158,9 @@ def __init__(
if self.__class__.data is not None:
self.set_data(*self.__class__.data)

def __init_subclass__(cls) -> None:
cls.PIPELINE_COUNT = 0

async def async_run(self, profile: str = "default") -> bool:
"""Run the processes one by one
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.3"
__version__ = "0.9.4"
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.3"
version = "0.9.4"
description = "A pipeline framework for python"
authors = [ "pwwang <[email protected]>",]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pipen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_name():
p = Pipen()
assert p.name == "p"
[p] = [Pipen()]
assert p.name.startswith("pipen-")
assert p.name.startswith("Pipen-")


def test_run(pipen):
Expand Down

0 comments on commit 00a4283

Please sign in to comment.