Open pamelafox opened 1 month ago
Hi @pamelafox , in our concept, flow should be self-contained. Which makes it easier to build flow snapshot and share from local to cloud. When flow has relative external imports, we could not build snapshot for it. But we can improve the error message to make it more friendly to customer.
Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!
I think promptflow should be able to work with files that import other files, as most developers use modules in order to improve code reusability. If I can't bring in any other files, then I will have to needlessly repeat common code across parts of my codebase.
Added a long-term tag for this. I have a proposal to introduce a code
field to flow's YAML. If user need to import outside of current working directory. They can set flow's code
to base folder.
For example, a project organized like this
src/
common/
flow1/
flow2/
The flow1
and flow2
can set code
in flow YAML like this
code: path/to/src
But, you'll need to use absolute import like this
from common import xxx
instead of relative import like this
from .. import xxx
since we used multi-processing to execute flow and relative import may fail to find it's parent package.
blocked on the same issue.
I am trying to use the promptflow-evals SDK in a project where I am using relative imports, which works fine because of how I call the modules (with python -m modulename).
However, PromptFlow tries to import my file for some reason, and then errors:
So now I have to restructure my project to avoid relative imports. Please loosen this constraint.