Skip to content




prefect-gitlab is a Prefect collection for working with GitLab repositories.

Getting Started

Python setup

Requires an installation of Python 3.7+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

This collection is designed to work with Prefect 2.3.0 or higher. For more information about how to use Prefect, please refer to the Prefect documentation.


Install prefect-gitlab with pip:

pip install prefect-gitlab

Then, register to view the storage block on Prefect Cloud:

prefect block register -m prefect_gitlab

Note, to use the load method on Blocks, you must already have a block document saved through code or saved through the UI.

Creating a GitLab storage block

In Python

from prefect_gitlab import GitLabRepository

# public GitLab repository
public_gitlab_block = GitLabRepository(

# specific branch or tag of a GitLab repository
branch_gitlab_block = GitLabRepository(

# private GitLab repository
private_gitlab_block = GitLabRepository(

In the UI

Click on the Blocks menu, then click the + button in the page header to open the block catalog: blocks menu

Then, find the GitLab block and click the Add button: GitLab block catalog entry

Finally, enter your repository information in the form and click Create: GitLab repository information form


If you encounter any bugs while using prefect-gitlab, feel free to open an issue in the prefect-gitlab repository.

If you have any questions or issues while using prefect-gitlab, you can find help in either the Prefect Discourse forum or the Prefect Slack community.

Feel free to ⭐️ or watch prefect-gitlab for updates too!


If you'd like to install a version of prefect-gitlab for development, clone the repository and perform an editable install with pip:

git clone

cd prefect-gitlab/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install