In short, question is if there is code outside the...
# ask-metaflow
f
In short, question is if there is code outside the step functions depending on a particular package, does the flow need to be at the top level of that package to be able to use it? I mean class level imports
1
c
Metaflow packages all the Python code from the directory level of the
flow.py
. In the example below, it will package all the Python files under main and therefore you can import them when running it remotely.
Copy code
.
|-- flow.py
`-- src
    `-- main.py
If you have another type of file added such as an SQL script, by default it will not be packaged, you will need to specify the appropriate extension to package via
--package-suffixes=.sql
Copy code
.
|-- flow.py
`-- src
    |-- main.py
    `-- query.sql
If you want to package modules that exist outside of the flow directory level, by default it will not work.
Copy code
.
|-- flows
|   `-- flow.py
`-- src
    |-- main.py
    `-- query.sql
You would need to perform a symlink of the module inside the Flow directory scope via
cd flows && ln -s ../src
The directory will look like this now:
Copy code
.
|-- flows
|   |-- flow.py
|   `-- src -> ../src
`-- src
    |-- main.py
    `-- query.sql
f
ok thank you! I will use one of these approaches.