diff --git a/src/prefect/cli/shell.py b/src/prefect/cli/shell.py index b0103883a83d..bc8bd559d9eb 100644 --- a/src/prefect/cli/shell.py +++ b/src/prefect/cli/shell.py @@ -18,11 +18,11 @@ from prefect.cli.root import app from prefect.client.schemas.schedules import CronSchedule from prefect.context import tags -from prefect.deployments.runner import EntrypointType from prefect.exceptions import FailedRun from prefect.logging.loggers import get_run_logger from prefect.runner import Runner from prefect.settings import PREFECT_UI_URL +from prefect.types.entrypoint import EntrypointType shell_app = PrefectTyper( name="shell", help="Serve and watch shell commands as Prefect flows." diff --git a/src/prefect/deployments/runner.py b/src/prefect/deployments/runner.py index 974c0c6b8351..f6244c134c4c 100644 --- a/src/prefect/deployments/runner.py +++ b/src/prefect/deployments/runner.py @@ -29,7 +29,6 @@ def fast_flow(): """ -import enum import importlib import tempfile from datetime import datetime, timedelta @@ -75,6 +74,7 @@ def fast_flow(): PREFECT_DEFAULT_WORK_POOL_NAME, PREFECT_UI_URL, ) +from prefect.types.entrypoint import EntrypointType from prefect.utilities.asyncutils import sync_compatible from prefect.utilities.callables import ParameterSchema, parameter_schema from prefect.utilities.collections import get_from_dict, isiterable @@ -100,18 +100,6 @@ class DeploymentApplyError(RuntimeError): """ -class EntrypointType(enum.Enum): - """ - Enum representing a entrypoint type. - - File path entrypoints are in the format: `path/to/file.py:function_name`. - Module path entrypoints are in the format: `path.to.module.function_name`. - """ - - FILE_PATH = "file_path" - MODULE_PATH = "module_path" - - class RunnerDeployment(BaseModel): """ A Prefect RunnerDeployment definition, used for specifying and building deployments. diff --git a/src/prefect/flows.py b/src/prefect/flows.py index 1fe1dc7b358f..278e064d5e17 100644 --- a/src/prefect/flows.py +++ b/src/prefect/flows.py @@ -57,7 +57,7 @@ from prefect.client.schemas.schedules import SCHEDULE_TYPES from prefect.client.utilities import client_injector from prefect.context import PrefectObjectRegistry, registry_from_script -from prefect.deployments.runner import DeploymentImage, EntrypointType, deploy +from prefect.deployments.runner import DeploymentImage, deploy from prefect.deployments.steps.core import run_steps from prefect.events import DeploymentTriggerTypes, TriggerTypes from prefect.exceptions import ( @@ -87,6 +87,7 @@ from prefect.states import State from prefect.task_runners import TaskRunner, ThreadPoolTaskRunner from prefect.types import BANNED_CHARACTERS, WITHOUT_BANNED_CHARACTERS +from prefect.types.entrypoint import EntrypointType from prefect.utilities.annotations import NotSet from prefect.utilities.asyncutils import ( run_sync_in_worker_thread, diff --git a/src/prefect/types/entrypoint.py b/src/prefect/types/entrypoint.py new file mode 100644 index 000000000000..ca0d02dda1ff --- /dev/null +++ b/src/prefect/types/entrypoint.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class EntrypointType(Enum): + """ + Enum representing a entrypoint type. + + File path entrypoints are in the format: `path/to/file.py:function_name`. + Module path entrypoints are in the format: `path.to.module.function_name`. + """ + + FILE_PATH = "file_path" + MODULE_PATH = "module_path" diff --git a/tests/test_flows.py b/tests/test_flows.py index c264c62b2c64..2f0b3bdf2ae8 100644 --- a/tests/test_flows.py +++ b/tests/test_flows.py @@ -32,7 +32,7 @@ RRuleSchedule, ) from prefect.context import PrefectObjectRegistry -from prefect.deployments.runner import DeploymentImage, EntrypointType, RunnerDeployment +from prefect.deployments.runner import DeploymentImage, RunnerDeployment from prefect.events import DeploymentEventTrigger, Posture from prefect.exceptions import ( CancelledRun, @@ -71,6 +71,7 @@ get_most_recent_flow_run, ) from prefect.transactions import transaction +from prefect.types.entrypoint import EntrypointType from prefect.utilities.annotations import allow_failure, quote from prefect.utilities.callables import parameter_schema from prefect.utilities.collections import flatdict_to_dict