Skip to content

Commit

Permalink
0.10.1 (#174)
Browse files Browse the repository at this point in the history
* ✨ Add `on_proc_script_computed` hook

* 🔖 0.10.1
  • Loading branch information
pwwang authored Jun 9, 2023
1 parent 4929be2 commit 37a99cc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 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.10.1

- ✨ Add `on_proc_script_computed` hook

## 0.10.0

- 💥 Change hook `on_proc_init` to `on_proc_create`
Expand Down
7 changes: 7 additions & 0 deletions docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ See [`simplug`][1] for more details.

Called after process input data is computed.

- `on_proc_script_computed(proc)` (sync)

Called after process script is computed.

The script is computed as a string that is about to compiled into a
template. You can modify the script here.

- `on_proc_init(proc)` (async)

When process object is initialized.
Expand Down
12 changes: 12 additions & 0 deletions pipen/pluginmgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ def on_proc_input_computed(proc: Proc):
"""


@plugin.spec
def on_proc_script_computed(proc: Proc):
"""Called after process script is computed.
The script is computed as a string that is about to compiled into a
template.
Args:
proc: The Proc object
"""


@plugin.spec
async def on_proc_start(proc: Proc):
"""When a process is starting
Expand Down
7 changes: 4 additions & 3 deletions pipen/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,12 @@ def _compute_script(self) -> Template:
)
script = script_file.read_text()

script = ignore_firstline_dedent(script)
self.script = ignore_firstline_dedent(script)
if not self.lang:
self.lang = get_shebang(script)
self.lang = get_shebang(self.script)

return self.template(script, **self.template_opts) # type: ignore
plugin.hooks.on_proc_script_computed(self)
return self.template(self.script, **self.template_opts) # type: ignore

def _log_info(self):
"""Log some basic information of the process"""
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.10.0"
__version__ = "0.10.1"
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.10.0"
version = "0.10.1"
description = "A pipeline framework for python"
authors = [ "pwwang <[email protected]>",]
license = "MIT"
Expand Down

0 comments on commit 37a99cc

Please sign in to comment.