From 52d1a9559c60a615dbd97114572f16d70fa30b1b Mon Sep 17 00:00:00 2001 From: Matthew F Leader Date: Wed, 20 Dec 2023 15:34:42 -0500 Subject: [PATCH 1/2] update as executable module-package --- arcaflow_plugin_template_python/__init__.py | 0 arcaflow_plugin_template_python/__main__.py | 4 ++++ arcaflow_plugin_template_python/cli.py | 17 +++++++++++++++++ .../template_python_plugin.py | 2 +- pyproject.toml | 4 ---- 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 arcaflow_plugin_template_python/__init__.py create mode 100644 arcaflow_plugin_template_python/__main__.py create mode 100644 arcaflow_plugin_template_python/cli.py diff --git a/arcaflow_plugin_template_python/__init__.py b/arcaflow_plugin_template_python/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/arcaflow_plugin_template_python/__main__.py b/arcaflow_plugin_template_python/__main__.py new file mode 100644 index 0000000..51d5827 --- /dev/null +++ b/arcaflow_plugin_template_python/__main__.py @@ -0,0 +1,4 @@ +from arcaflow_plugin_template_python import cli + + +cli.main() \ No newline at end of file diff --git a/arcaflow_plugin_template_python/cli.py b/arcaflow_plugin_template_python/cli.py new file mode 100644 index 0000000..04c5986 --- /dev/null +++ b/arcaflow_plugin_template_python/cli.py @@ -0,0 +1,17 @@ +import sys +from arcaflow_plugin_sdk import plugin as plugin_sdk +import arcaflow_plugin_template_python.template_python_plugin as template_plugin + + +def main(): + sys.exit( + plugin_sdk.run( + plugin_sdk.build_schema( + # List your step functions here: + template_plugin.hello_world, + ) + ) + ) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/arcaflow_plugin_template_python/template_python_plugin.py b/arcaflow_plugin_template_python/template_python_plugin.py index 4b2260c..ea2a8e8 100644 --- a/arcaflow_plugin_template_python/template_python_plugin.py +++ b/arcaflow_plugin_template_python/template_python_plugin.py @@ -3,7 +3,7 @@ import sys import typing from arcaflow_plugin_sdk import plugin -from template_python_schema import ( +from arcaflow_plugin_template_python.template_python_schema import ( InputParams, SuccessOutput, ErrorOutput, diff --git a/pyproject.toml b/pyproject.toml index fbc125c..869d3f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,10 +5,6 @@ description = "" authors = ["Arcalot"] license = "Apache-2.0+GPL-2.0-only" -packages = [ - { include="template_python_plugin.py", from="./arcaflow_plugin_template_python" }, -] - [tool.poetry.dependencies] python = "^3.9" arcaflow-plugin-sdk = "^0.13.0" From 2834fa4ca8343846673188f4e8f3386bf80138d7 Mon Sep 17 00:00:00 2001 From: Matthew F Leader Date: Wed, 20 Dec 2023 18:59:48 -0500 Subject: [PATCH 2/2] change containerfile --- Dockerfile | 8 ++++---- tests/test_arcaflow_plugin_template_python.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5648e8c..ee90fba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,10 @@ RUN python -m poetry install --without dev --no-root \ && python -m poetry export -f requirements.txt --output requirements.txt --without-hashes COPY ${package}/ /app/${package} -COPY tests /app/${package}/tests +COPY tests /app/tests ENV PYTHONPATH /app/${package} -WORKDIR /app/${package} +WORKDIR /app/ # Run tests and return coverage analysis RUN python -m coverage run tests/test_${package}.py \ @@ -38,9 +38,9 @@ COPY ${package}/ /app/${package} # Install all plugin dependencies from the generated requirements.txt file RUN python -m pip install -r requirements.txt -WORKDIR /app/${package} +WORKDIR /app -ENTRYPOINT ["python", "template_python_plugin.py"] +ENTRYPOINT ["python", "-m", "arcaflow_plugin_template_python"] CMD [] LABEL org.opencontainers.image.source="https://github.com/arcalot/arcaflow-plugin-template-python" diff --git a/tests/test_arcaflow_plugin_template_python.py b/tests/test_arcaflow_plugin_template_python.py index 7759ea5..747f530 100644 --- a/tests/test_arcaflow_plugin_template_python.py +++ b/tests/test_arcaflow_plugin_template_python.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import unittest -import template_python_plugin +import arcaflow_plugin_template_python.template_python_plugin as template_python_plugin from arcaflow_plugin_sdk import plugin