Skip to content

Commit 4d7f03f

Browse files
authored
Merge pull request #14 from NetherlandsForensicInstitute/0.9.1_added_transformers_and_updated_dependencies
update the template for release 0.9.4: added transformer and added doc for transformer
2 parents b08ff56 + eff13be commit 4d7f03f

5 files changed

Lines changed: 27 additions & 17 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Hansken Extraction Plugin template for Python based on version 0.8.3
1+
# Hansken Extraction Plugin template for Python based on version 0.9.4
22

33
This repository contains a template for a Hansken extraction plugin written in Python.
44
This template is a minimal but complete example of a plugin implementation, including all required build steps.
@@ -14,6 +14,8 @@ To transform this skeleton in your plugin your may want to:
1414
* Create test input data in the folder [`testdata/input`](testdata/input)
1515
(refer to the [SDK manual for more details on how to define test data](https://netherlandsforensicinstitute.github.io/hansken-extraction-plugin-sdk-documentation/latest/dev/concepts/test_framework.html))
1616
* Implement your plugin `process()` logic in [`plugin.py`](plugin.py)
17+
* (Optional) Implement your own transformers(https://netherlandsforensicinstitute.github.io/hansken-extraction-plugin-sdk-documentation/latest/dev/python/transformers.html) in the example_transformer() [`plugin.py`](plugin.py),
18+
or remove the transformer method from the plugin.
1719
* Add your plugin dependencies to [`requirements.in`](requirements.in)
1820
and regenerate `requirements.txt` by calling `tox -e upgrade`
1921
* Add any system dependencies to the [`Dockerfile`](Dockerfile)

plugin.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from hansken_extraction_plugin.api.extraction_plugin import ExtractionPlugin
22
from hansken_extraction_plugin.api.plugin_info import Author, MaturityLevel, PluginId, PluginInfo, PluginResources
3+
from hansken_extraction_plugin.decorators.transformer import transformer
34
from hansken_extraction_plugin.runtime.extraction_plugin_runner import run_with_hanskenpy
45
from logbook import Logger
56

@@ -26,9 +27,16 @@ def process(self, trace, data_context):
2627
log.info(f"processing trace {trace.get('name')}")
2728
# Add your plugin implementation here
2829

30+
@transformer
31+
def example_transformer(self, number: int) -> int:
32+
# Optional transformer method to run this method with a REST call
33+
# See detail at:
34+
# https://netherlandsforensicinstitute.github.io/hansken-extraction-plugin-sdk-documentation/latest/dev/python/transformers.html
35+
return number + 1
2936

3037
if __name__ == '__main__':
31-
# optional main method to run your plugin with Hansken.py
32-
# see detail at:
38+
# Optional main method to run your plugin with Hansken.py
39+
# See detail at:
3340
# https://netherlandsforensicinstitute.github.io/hansken-extraction-plugin-sdk-documentation/latest/dev/python/hanskenpy.html
3441
run_with_hanskenpy(Plugin)
42+

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hansken-extraction-plugin==0.8.3
1+
hansken-extraction-plugin == 0.9.4

requirements.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
certifi==2024.8.30
1+
certifi==2025.1.31
22
# via requests
3-
charset-normalizer==3.3.2
3+
charset-normalizer==3.4.1
44
# via requests
55
decorator==5.1.1
66
# via hansken
77
docker==7.1.0
88
# via hansken-extraction-plugin
9-
grpcio==1.66.2
9+
grpcio==1.70.0
1010
# via hansken-extraction-plugin
11-
hansken==2024.7.15
11+
hansken==2024.12.4
1212
# via hansken-extraction-plugin
13-
hansken-extraction-plugin==0.8.3
13+
hansken-extraction-plugin==0.9.4
1414
# via -r requirements.in
1515
idna==3.10
1616
# via requests
1717
ijson==3.3.0
1818
# via hansken
1919
iso8601==2.1.0
2020
# via hansken
21-
logbook==1.7.0.post0
21+
logbook==1.8.0
2222
# via
2323
# hansken
2424
# hansken-extraction-plugin
25-
more-itertools==10.5.0
25+
more-itertools==10.6.0
2626
# via hansken
27-
protobuf==5.28.2
27+
protobuf==5.29.3
2828
# via hansken-extraction-plugin
2929
python-dateutil==2.9.0.post0
3030
# via hansken
31-
pytz==2024.2
31+
pytz==2025.1
3232
# via hansken-extraction-plugin
3333
requests==2.32.3
3434
# via
@@ -37,13 +37,13 @@ requests==2.32.3
3737
# requests-toolbelt
3838
requests-toolbelt==1.0.0
3939
# via hansken
40-
six==1.16.0
40+
six==1.17.0
4141
# via python-dateutil
4242
tabulate==0.9.0
4343
# via hansken
4444
typing-extensions==4.12.2
4545
# via hansken-extraction-plugin
46-
urllib3==2.2.3
46+
urllib3==2.3.0
4747
# via
4848
# docker
4949
# requests

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ commands = test_plugin --standalone plugin.py
1010
commands = test_plugin --standalone plugin.py --regenerate
1111

1212
[testenv:package]
13-
deps = hansken-extraction-plugin==0.8.3
13+
deps = hansken-extraction-plugin==0.9.4
1414
commands = build_plugin . {posargs}
1515

1616
[testenv:integration-test]
17-
deps = hansken-extraction-plugin==0.8.3
17+
deps = hansken-extraction-plugin==0.9.4
1818
commands =
1919
build_plugin . plugin-to-test {posargs}
2020
test_plugin --docker plugin-to-test

0 commit comments

Comments
 (0)