Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor into executable module/package #67

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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"
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions arcaflow_plugin_template_python/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from arcaflow_plugin_template_python import cli


cli.main()
17 changes: 17 additions & 0 deletions arcaflow_plugin_template_python/cli.py
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 1 addition & 1 deletion arcaflow_plugin_template_python/template_python_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_arcaflow_plugin_template_python.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down