https://prefect.io logo
f

Farid

02/04/2022, 12:45 AM
Hi there, I’m trying to setup a demo flow package inspired from here, the idea is to keep Gitlab as a source of truth and as a
STORAGE
for the flows and have the Gitlab CI/CD register the flows to the Prefect Cloud. However, I receive an error when I try to run the dummy flow taken from the official docs :
Copy code
from prefect import task, Flow
from prefect.storage import Gitlab


@task(log_stdout=True)
def hello_task():
    text = f"hello World"
    print(text)
    return text


with Flow(
    "hello-flow",
    storage=Gitlab(
        repo="predicthq/data-engineering/prefect-server",
        path="flows/hello-world/flow_hello_flow.py",
        access_token_secret="",
    ),
) as flow:
    hello_task()
The error:
Copy code
(.venv) ➜  prefect-server git:(main) ✗ python flows/hello-world/flow_hello_flow.py
Traceback (most recent call last):
  File "/Users/farid/WorkSpace/Github_Repos/dataobs-poc/prefect-server/flows/hello-world/flow_hello_flow.py", line 2, in <module>
    from prefect.storage import Gitlab
ImportError: cannot import name 'Gitlab' from 'prefect.storage' (/Users/farid/WorkSpace/Github_Repos/dataobs-poc/prefect-server/.venv/lib/python3.9/site-packages/prefect/storage/__init__.py)
Looking at the source code, I don’t see anything that could cause a dependency circle. Any idea what it could be causing this? Needles to say that I have installed the gitlab package:
pip install 'prefect[gitlab]'
k

Kevin Kho

02/04/2022, 12:49 AM
Can you show me a longer traceback if you have it?
And I am as confused as you
😆 1
f

Farid

02/04/2022, 12:52 AM
This is all the error that I get unfortunately, I tested it on Python 3.7 inside a docker image as well but I get the same result
k

Kevin Kho

02/04/2022, 12:55 AM
I can replicate. Let me think
You want capital
Copy code
from prefect.storage import GitLab
🙌 1
@Marvin open “Gitlab example has wrong import”
f

Farid

02/04/2022, 1:09 AM
Haha I knew it would be something as simple as this, thanks @Kevin Kho
6 Views