@Marvin I would like to install my prefect workflow as a package and be able to run it from anywhere on my machine. When I try to run the workflow from a directory that doesn't contain the workflow as a subdirectory of my current path I get an error. The error comes from prefect.deployments.runner calling pathlib.Path.relative_to between with my current working directory and the path to my workflow. Is there a way around this? Here is the error: Traceback (most recent call last):
File "$HOME/devel/my-flow/.venv/bin/my-flow", line 8, in <module>
sys.exit(app())
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/typer/main.py", line 342, in
call
raise e
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/typer/main.py", line 325, in
call
return get_command(self)(*args, **kwargs)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/click/core.py", line 1161, in
call
return self.main(*args, **kwargs)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/typer/core.py", line 675, in main
return _main(
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/typer/core.py", line 197, in _main
rv = self.invoke(ctx)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/typer/main.py", line 707, in wrapper
return callback(**use_params)
File "$HOME/devel/my-flow/src/my_flow/main.py", line 90, in entrypoint
my_flow_flow.serve(
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/flows.py", line 881, in serve
deployment_id = runner.add_flow(
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 353, in coroutine_wrapper
return run_coro_as_sync(ctx_call())
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 209, in run_coro_as_sync
return call.result()
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 330, in result
return self.future.result(timeout=timeout)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 193, in result
return self.__get_result()
File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 403, in _run_async
result = await coro
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 190, in coroutine_wrapper
return await task
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 343, in ctx_call
result = await async_fn(*args, **kwargs)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/runner/runner.py", line 320, in add_flow
deployment = await
flow.to_deployment(
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 343, in ctx_call
result = await async_fn(*args, **kwargs)
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/flows.py", line 739, in to_deployment
return RunnerDeployment.from_flow(
File "$HOME/devel/my-flow/.venv/lib/python3.10/site-packages/prefect/deployments/runner.py", line 609, in from_flow
Path(flow_file).absolute().relative_to(Path.cwd().absolute())
File "/usr/lib/python3.10/pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '$HOME/devel/my-flow/src/my_flow/my_flow_flow.py' is not in the subpath of '$HOME/test' OR one path is relative and the other is absolute.