```# Prefect version, path: clients/GOOGLE/test_fl...
# ask-community
v
Copy code
# Prefect version, path: clients/GOOGLE/test_flow/prefect.yaml
prefect-version: 3.2.9  # Replace with the Prefect version you're using
name: test-flow

pull:
- prefect.deployments.steps.git_clone:
    id: clone-step   # needed to be referenced in subsequent steps
    repository: <https://github.com/user/codebase.git>
    credentials: '{{ prefect.blocks.github-credentials.github-credential-user }}'
- prefect.deployments.steps.pip_install_requirements:
    id: requirements-step   
    directory: clients/GOOGLE/test_flow
    requirements_file: requirements.txt

# Deployment configurations
deployments:
- name: test-flow-github-deploy
  entrypoint: flows/test_flow.py:test_flow
  work_pool:
    name: default-pool
    work_queue_name:
    job_variables: {}
  schedule:
  parameters: 
  version: '0.1'
  tags: []
  concurrency_limit:
  description: 
  schedules: []
my run fails because its expecting
flows/test_flow.py
to be at root of repo where as it is inside
clients/GOOGLE/test_flow
, the same location as
requirements.txt
and my
prefect.yaml
for this flow deploy. if I change entrypoint to ``clients/GOOGLE/test_flow/flows/test_flow.py`` then the deploy fails since it runs entrypoint relative to prefect.yaml path. here is the dir struct:
Copy code
repo_root:
- clients/GOOGLE/test_flow/flows
- clients/GOOGLE/test_flow/tasks
- clients/GOOGLE/test_flow/prefect.yaml
- clients/GOOGLE/test_flow/requirements.txt
- clients/YAHOO/test_flow/flows
- clients/YAHOO/test_flow/tasks
- clients/YAHOO/test_flow/prefect.yaml
- clients/YAHOO/test_flow/requirements.txt
endgoal is to use one repo to manage all clients flows, how do I set directory inside deployments if my yaml files are inside each client folders?
n
hi @Victor - have you tried using the
--prefect-file
flag for
prefect deploy
? you could check out this example https://github.com/zzstoatzz/prefect-pack/tree/main/flows/be_modal where im following a couple hard rules • always run
prefect deploy
from repo root • always specify
entrypoint
relative to repo root because this example was motivated by a user who wanted to run
make deploy
from within their specific folder, the
make
command cd's out to root you might want to plus 1 this issue, as it would relax that second rule above and perhaps make setups like yours easier to reason about
v
Hey Nate, thank you for such a detailed answer.
-prefect-file
arg worked but was facing issues with tasks import failure in flows due to path issues. I was able to add
___init___.py
to all folders to make them python module and then refer to tasks folder using root reference. Thank you so much for the help.
n
catjam
catjam 1
v
my flow fails with errors tasks not found if I do this in my flow:
Copy code
from tasks.download_reports import generate_and_download_pdfs
but if I update it to:
Copy code
from clients.GOOGLE.test_flow.tasks.download_reports from generate_and_download_pdfs
it stops working locally and I am unable to test things. same goes with my utils folder.
n
i think the solution here is to build a proper python package, for example: https://github.com/zzstoatzz/prefect-pack/blob/main/pyproject.toml
Copy code
» uv sync
Resolved 136 packages in 1ms
Audited 132 packages in 0.28ms
» uv run python -c "from prefect_pack.utils import parse_as;print(parse_as)"
<function parse_as at 0x104e172e0>
so i'm using
uv
(which I'd recommend) but you can use
pip install .
as i mention in the readme and this way you have a static and unambiguous import,
from your_package.submodule import your_thing
so whether you do the
pip install .
in your dockerfile or in a
pull
step or something, that's up to you, but I would build a python package so your imports are consistent
👏 1