From 9153637e155b5e10081890e6a2b7a36378e0eabe Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Mon, 3 Oct 2022 20:20:30 -0400 Subject: [PATCH 1/5] Point backend to local SpiffWorkflow --- poetry.lock | 19 +++++++++---------- pyproject.toml | 5 ++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3ace24fa..41f2b408 100644 --- a/poetry.lock +++ b/poetry.lock @@ -823,7 +823,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "importlib-metadata" -version = "5.0.0" +version = "4.13.0" description = "Read metadata from Python packages" category = "main" optional = false @@ -1827,24 +1827,23 @@ test = ["pytest"] [[package]] name = "SpiffWorkflow" version = "1.1.7" -description = "A workflow framework and BPMN/DMN Processor" +description = "" category = "main" optional = false python-versions = "*" -develop = false +develop = true [package.dependencies] celery = "*" configparser = "*" dateparser = "*" +importlib-metadata = "<5.0" lxml = "*" pytz = "*" [package.source] -type = "git" -url = "https://github.com/sartography/SpiffWorkflow" -reference = "feature/get-description-when-parsing-service-task" -resolved_reference = "e6d8478bcaf19ad90c13dc0a250513a6bfa90760" +type = "directory" +url = "../SpiffWorkflow" [[package]] name = "SQLAlchemy" @@ -2156,7 +2155,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "10b2edb09b9d220cd547527238bb49ff8fe01dd2406e85f0ff6fa2fbc9cca1ce" +content-hash = "824ef54e5706f4a50e0bd68e67acb5f1b46bdca03b27dab4ff9c48fe57c5f53e" [metadata.files] alabaster = [ @@ -2521,8 +2520,8 @@ imagesize = [ {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"}, ] importlib-metadata = [ - {file = "importlib_metadata-5.0.0-py3-none-any.whl", hash = "sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43"}, - {file = "importlib_metadata-5.0.0.tar.gz", hash = "sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab"}, + {file = "importlib_metadata-4.13.0-py3-none-any.whl", hash = "sha256:8a8a81bcf996e74fee46f0d16bd3eaa382a7eb20fd82445c3ad11f4090334116"}, + {file = "importlib_metadata-4.13.0.tar.gz", hash = "sha256:dd0173e8f150d6815e098fd354f6414b0f079af4644ddfe90c71e2fc6174346d"}, ] inflection = [ {file = "inflection-0.5.1-py2.py3-none-any.whl", hash = "sha256:f38b2b640938a4f35ade69ac3d053042959b62a0f1076a5bbaa1b9526605a8a2"}, diff --git a/pyproject.toml b/pyproject.toml index e4ec038f..8df25d35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,8 @@ flask-migrate = "*" flask-restful = "*" werkzeug = "*" # go back to main once https://github.com/sartography/SpiffWorkflow/pull/241 is merged -SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "feature/get-description-when-parsing-service-task"} -# SpiffWorkflow = {develop = true, path = "/Users/kevin/projects/github/sartography/SpiffWorkflow"} -# SpiffWorkflow = {develop = true, path = "/home/jason/projects/github/sartography/SpiffWorkflow"} +# SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "feature/get-description-when-parsing-service-task"} +SpiffWorkflow = {develop = true, path = "../SpiffWorkflow"} sentry-sdk = "1.9.0" sphinx-autoapi = "^1.8.4" # flask-bpmn = {develop = true, path = "/home/jason/projects/github/sartography/flask-bpmn"} From 0de2676f9a8eddf7ede3a09d9598d2ef41c3ff66 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Mon, 3 Oct 2022 21:52:19 -0400 Subject: [PATCH 2/5] Reworking imports after empty __init__.py --- poetry.lock | 2 +- src/spiffworkflow_backend/routes/process_api_blueprint.py | 4 ++-- src/spiffworkflow_backend/scripts/fact_service.py | 2 +- src/spiffworkflow_backend/scripts/get_env.py | 2 +- src/spiffworkflow_backend/scripts/script.py | 2 +- .../services/process_instance_processor.py | 6 +++--- .../services/script_unit_test_runner.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/poetry.lock b/poetry.lock index 41f2b408..171cc3c2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1827,7 +1827,7 @@ test = ["pytest"] [[package]] name = "SpiffWorkflow" version = "1.1.7" -description = "" +description = "A workflow framework and BPMN/DMN Processor" category = "main" optional = false python-versions = "*" diff --git a/src/spiffworkflow_backend/routes/process_api_blueprint.py b/src/spiffworkflow_backend/routes/process_api_blueprint.py index f13240df..e13254c3 100644 --- a/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -23,8 +23,8 @@ from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from lxml import etree # type: ignore from lxml.builder import ElementMaker # type: ignore -from SpiffWorkflow import Task as SpiffTask # type: ignore -from SpiffWorkflow import TaskState +from SpiffWorkflow.task import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import TaskState from sqlalchemy import desc from spiffworkflow_backend.exceptions.process_entity_not_found_error import ( diff --git a/src/spiffworkflow_backend/scripts/fact_service.py b/src/spiffworkflow_backend/scripts/fact_service.py index 4fb84a60..ea585d2a 100644 --- a/src/spiffworkflow_backend/scripts/fact_service.py +++ b/src/spiffworkflow_backend/scripts/fact_service.py @@ -2,7 +2,7 @@ from typing import Any from typing import Optional -from SpiffWorkflow import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import Task as SpiffTask # type: ignore from spiffworkflow_backend.scripts.script import Script diff --git a/src/spiffworkflow_backend/scripts/get_env.py b/src/spiffworkflow_backend/scripts/get_env.py index 6d69e361..310bcdec 100644 --- a/src/spiffworkflow_backend/scripts/get_env.py +++ b/src/spiffworkflow_backend/scripts/get_env.py @@ -2,7 +2,7 @@ from typing import Any from typing import Optional -from SpiffWorkflow import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import Task as SpiffTask # type: ignore from spiffworkflow_backend.scripts.script import Script diff --git a/src/spiffworkflow_backend/scripts/script.py b/src/spiffworkflow_backend/scripts/script.py index 16cc9b2c..f36e4ace 100644 --- a/src/spiffworkflow_backend/scripts/script.py +++ b/src/spiffworkflow_backend/scripts/script.py @@ -9,7 +9,7 @@ from typing import Any from typing import Callable from flask_bpmn.api.api_error import ApiError -from SpiffWorkflow import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import Task as SpiffTask # type: ignore # Generally speaking, having some global in a flask app is TERRIBLE. # This is here, because after loading the application this will never change under diff --git a/src/spiffworkflow_backend/services/process_instance_processor.py b/src/spiffworkflow_backend/services/process_instance_processor.py index 8ec69e72..da227f5c 100644 --- a/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/src/spiffworkflow_backend/services/process_instance_processor.py @@ -16,9 +16,9 @@ from flask import current_app from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from lxml import etree # type: ignore -from SpiffWorkflow import Task as SpiffTask # type: ignore -from SpiffWorkflow import TaskState -from SpiffWorkflow import WorkflowException +from SpiffWorkflow.task import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import TaskState +from SpiffWorkflow.exceptions import WorkflowException from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore from SpiffWorkflow.bpmn.PythonScriptEngine import Box # type: ignore diff --git a/src/spiffworkflow_backend/services/script_unit_test_runner.py b/src/spiffworkflow_backend/services/script_unit_test_runner.py index b9756050..90ea705c 100644 --- a/src/spiffworkflow_backend/services/script_unit_test_runner.py +++ b/src/spiffworkflow_backend/services/script_unit_test_runner.py @@ -6,7 +6,7 @@ from dataclasses import dataclass from typing import Any from typing import Optional -from SpiffWorkflow import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore from spiffworkflow_backend.services.process_instance_processor import ( From a363650fd3281d5c21d471f33fe731d801c8dd16 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Mon, 3 Oct 2022 21:56:45 -0400 Subject: [PATCH 3/5] Point flask-bpmn to local dir, update import --- poetry.lock | 10 ++++------ pyproject.toml | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index 171cc3c2..b4deeb2a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -621,7 +621,7 @@ description = "Flask Bpmn" category = "main" optional = false python-versions = "^3.7" -develop = false +develop = true [package.dependencies] click = "^8.0.1" @@ -639,10 +639,8 @@ spiffworkflow = "*" werkzeug = "*" [package.source] -type = "git" -url = "https://github.com/sartography/flask-bpmn" -reference = "main" -resolved_reference = "16eb4fc1b5b314934b2967a6727b09bb3b8479d0" +type = "directory" +url = "../flask-bpmn" [[package]] name = "Flask-Cors" @@ -2155,7 +2153,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "824ef54e5706f4a50e0bd68e67acb5f1b46bdca03b27dab4ff9c48fe57c5f53e" +content-hash = "d2468e77fc2b18312be9215dcc4c6535e2ba9d225e5fc00599d634277c421c02" [metadata.files] alabaster = [ diff --git a/pyproject.toml b/pyproject.toml index 8df25d35..074e3a72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,9 +32,8 @@ werkzeug = "*" SpiffWorkflow = {develop = true, path = "../SpiffWorkflow"} sentry-sdk = "1.9.0" sphinx-autoapi = "^1.8.4" -# flask-bpmn = {develop = true, path = "/home/jason/projects/github/sartography/flask-bpmn"} -# flask-bpmn = {develop = true, path = "/Users/kevin/projects/github/sartography/flask-bpmn"} -flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"} +flask-bpmn = {develop = true, path = "../flask-bpmn"} +# flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"} mysql-connector-python = "^8.0.29" pytest-flask = "^1.2.0" pytest-flask-sqlalchemy = "^1.1.0" From 9fc48f6e94c1bac8bf9279572f9756afc170eea7 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Tue, 4 Oct 2022 15:21:52 -0400 Subject: [PATCH 4/5] Revert poetry changes --- poetry.lock | 25 ++++++++++++++----------- pyproject.toml | 10 ++++++---- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/poetry.lock b/poetry.lock index b4deeb2a..3ace24fa 100644 --- a/poetry.lock +++ b/poetry.lock @@ -621,7 +621,7 @@ description = "Flask Bpmn" category = "main" optional = false python-versions = "^3.7" -develop = true +develop = false [package.dependencies] click = "^8.0.1" @@ -639,8 +639,10 @@ spiffworkflow = "*" werkzeug = "*" [package.source] -type = "directory" -url = "../flask-bpmn" +type = "git" +url = "https://github.com/sartography/flask-bpmn" +reference = "main" +resolved_reference = "16eb4fc1b5b314934b2967a6727b09bb3b8479d0" [[package]] name = "Flask-Cors" @@ -821,7 +823,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "importlib-metadata" -version = "4.13.0" +version = "5.0.0" description = "Read metadata from Python packages" category = "main" optional = false @@ -1829,19 +1831,20 @@ description = "A workflow framework and BPMN/DMN Processor" category = "main" optional = false python-versions = "*" -develop = true +develop = false [package.dependencies] celery = "*" configparser = "*" dateparser = "*" -importlib-metadata = "<5.0" lxml = "*" pytz = "*" [package.source] -type = "directory" -url = "../SpiffWorkflow" +type = "git" +url = "https://github.com/sartography/SpiffWorkflow" +reference = "feature/get-description-when-parsing-service-task" +resolved_reference = "e6d8478bcaf19ad90c13dc0a250513a6bfa90760" [[package]] name = "SQLAlchemy" @@ -2153,7 +2156,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>= [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "d2468e77fc2b18312be9215dcc4c6535e2ba9d225e5fc00599d634277c421c02" +content-hash = "10b2edb09b9d220cd547527238bb49ff8fe01dd2406e85f0ff6fa2fbc9cca1ce" [metadata.files] alabaster = [ @@ -2518,8 +2521,8 @@ imagesize = [ {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.13.0-py3-none-any.whl", hash = "sha256:8a8a81bcf996e74fee46f0d16bd3eaa382a7eb20fd82445c3ad11f4090334116"}, - {file = "importlib_metadata-4.13.0.tar.gz", hash = "sha256:dd0173e8f150d6815e098fd354f6414b0f079af4644ddfe90c71e2fc6174346d"}, + {file = "importlib_metadata-5.0.0-py3-none-any.whl", hash = "sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43"}, + {file = "importlib_metadata-5.0.0.tar.gz", hash = "sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab"}, ] inflection = [ {file = "inflection-0.5.1-py2.py3-none-any.whl", hash = "sha256:f38b2b640938a4f35ade69ac3d053042959b62a0f1076a5bbaa1b9526605a8a2"}, diff --git a/pyproject.toml b/pyproject.toml index 074e3a72..e4ec038f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,12 +28,14 @@ flask-migrate = "*" flask-restful = "*" werkzeug = "*" # go back to main once https://github.com/sartography/SpiffWorkflow/pull/241 is merged -# SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "feature/get-description-when-parsing-service-task"} -SpiffWorkflow = {develop = true, path = "../SpiffWorkflow"} +SpiffWorkflow = {git = "https://github.com/sartography/SpiffWorkflow", rev = "feature/get-description-when-parsing-service-task"} +# SpiffWorkflow = {develop = true, path = "/Users/kevin/projects/github/sartography/SpiffWorkflow"} +# SpiffWorkflow = {develop = true, path = "/home/jason/projects/github/sartography/SpiffWorkflow"} sentry-sdk = "1.9.0" sphinx-autoapi = "^1.8.4" -flask-bpmn = {develop = true, path = "../flask-bpmn"} -# flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"} +# flask-bpmn = {develop = true, path = "/home/jason/projects/github/sartography/flask-bpmn"} +# flask-bpmn = {develop = true, path = "/Users/kevin/projects/github/sartography/flask-bpmn"} +flask-bpmn = {git = "https://github.com/sartography/flask-bpmn", rev = "main"} mysql-connector-python = "^8.0.29" pytest-flask = "^1.2.0" pytest-flask-sqlalchemy = "^1.1.0" From c186da245100b49b53132552bdd4bea31ec3246a Mon Sep 17 00:00:00 2001 From: burnettk Date: Tue, 4 Oct 2022 17:27:31 -0400 Subject: [PATCH 5/5] merge main, reorder imports --- poetry.lock | 2 +- src/spiffworkflow_backend/services/git_service.py | 13 +++++++------ .../services/process_instance_processor.py | 6 +++--- .../services/script_unit_test_runner.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0f1f50f0..6aa985e1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -642,7 +642,7 @@ werkzeug = "*" type = "git" url = "https://github.com/sartography/flask-bpmn" reference = "main" -resolved_reference = "16eb4fc1b5b314934b2967a6727b09bb3b8479d0" +resolved_reference = "b33362f2d62bbb4c1d1a1c992f6b057c8e71431c" [[package]] name = "Flask-Cors" diff --git a/src/spiffworkflow_backend/services/git_service.py b/src/spiffworkflow_backend/services/git_service.py index 6a192b97..815e4cad 100644 --- a/src/spiffworkflow_backend/services/git_service.py +++ b/src/spiffworkflow_backend/services/git_service.py @@ -43,13 +43,14 @@ class GitService: def commit(message: str) -> str: """Commit.""" bpmn_spec_absolute_dir = current_app.config["BPMN_SPEC_ABSOLUTE_DIR"] - git_username = '' - git_email = '' - if current_app.config["GIT_COMMIT_USERNAME"] and current_app.config["GIT_COMMIT_EMAIL"]: + git_username = "" + git_email = "" + if ( + current_app.config["GIT_COMMIT_USERNAME"] + and current_app.config["GIT_COMMIT_EMAIL"] + ): git_username = current_app.config["GIT_COMMIT_USERNAME"] git_email = current_app.config["GIT_COMMIT_EMAIL"] - shell_command = ( - f"./bin/git_commit_bpmn_models_repo '{bpmn_spec_absolute_dir}' '{message}' '{git_username}' '{git_email}'" - ) + shell_command = f"./bin/git_commit_bpmn_models_repo '{bpmn_spec_absolute_dir}' '{message}' '{git_username}' '{git_email}'" output = os.popen(shell_command).read() # noqa: S605 return output diff --git a/src/spiffworkflow_backend/services/process_instance_processor.py b/src/spiffworkflow_backend/services/process_instance_processor.py index da227f5c..c5a4c635 100644 --- a/src/spiffworkflow_backend/services/process_instance_processor.py +++ b/src/spiffworkflow_backend/services/process_instance_processor.py @@ -16,9 +16,6 @@ from flask import current_app from flask_bpmn.api.api_error import ApiError from flask_bpmn.models.db import db from lxml import etree # type: ignore -from SpiffWorkflow.task import Task as SpiffTask # type: ignore -from SpiffWorkflow.task import TaskState -from SpiffWorkflow.exceptions import WorkflowException from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore from SpiffWorkflow.bpmn.PythonScriptEngine import Box # type: ignore @@ -30,6 +27,7 @@ from SpiffWorkflow.bpmn.specs.events import EndEvent from SpiffWorkflow.bpmn.workflow import BpmnWorkflow # type: ignore from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser # type: ignore from SpiffWorkflow.dmn.serializer import BusinessRuleTaskConverter # type: ignore +from SpiffWorkflow.exceptions import WorkflowException # type: ignore from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore from SpiffWorkflow.spiff.parser.process import SpiffBpmnParser # type: ignore from SpiffWorkflow.spiff.serializer import BoundaryEventConverter # type: ignore @@ -47,6 +45,8 @@ from SpiffWorkflow.spiff.serializer import StartEventConverter from SpiffWorkflow.spiff.serializer import SubWorkflowTaskConverter from SpiffWorkflow.spiff.serializer import TransactionSubprocessConverter from SpiffWorkflow.spiff.serializer import UserTaskConverter +from SpiffWorkflow.task import Task as SpiffTask # type: ignore +from SpiffWorkflow.task import TaskState from SpiffWorkflow.util.deep_merge import DeepMerge # type: ignore from spiffworkflow_backend.models.active_task import ActiveTaskModel diff --git a/src/spiffworkflow_backend/services/script_unit_test_runner.py b/src/spiffworkflow_backend/services/script_unit_test_runner.py index 90ea705c..9112e20f 100644 --- a/src/spiffworkflow_backend/services/script_unit_test_runner.py +++ b/src/spiffworkflow_backend/services/script_unit_test_runner.py @@ -6,8 +6,8 @@ from dataclasses import dataclass from typing import Any from typing import Optional -from SpiffWorkflow.task import Task as SpiffTask # type: ignore from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore +from SpiffWorkflow.task import Task as SpiffTask # type: ignore from spiffworkflow_backend.services.process_instance_processor import ( CustomBpmnScriptEngine,