Registry / devops / prefect-gitlab

prefect-gitlab

JSON →
library0.3.5pypypi✓ verified 87d ago

A Prefect collection for interacting with GitLab repositories. Provides blocks and tasks to manage GitLab resources (e.g., repositories, merge requests, CI/CD) within Prefect flows. Current version: 0.3.4. Released as part of the Prefect integration ecosystem; release cadence follows Prefect main branch releases.

pip install prefect-gitlab
INSTALL
IMPORT
SIG · PREFECT-GITLAB
P
prefect-gitlab
devopspythonv0.3.5
Install
21.0s avg
Import
5495ms
Disk
246MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 5.704s · 250.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 21.0s · import 5.286s · 251MB
246MB installed
● package 246MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GitLabCredentials
from prefect_gitlab import GitLabCredentials
Common mistake: trying to import from prefect_gitlab.credentials or other nested paths.
GitLabRepository
from prefect_gitlab import GitLabRepository
from prefect_gitlab.repositories import GitLabRepository
GitLabRepository is exposed at the top-level package.

Minimal example: instantiate GitLabCredentials with a token, then use GitLabRepository to interact with a GitLab project.

import os from prefect import flow from prefect_gitlab import GitLabCredentials, GitLabRepository @flow def gitlab_example(): credentials = GitLabCredentials( url="https://gitlab.com", token=os.environ.get("GITLAB_TOKEN", ""), ) repo = GitLabRepository( credentials=credentials, repository="namespace/project", ) # Example: list recent commits commits = repo.list_commits() print(commits) if __name__ == "__main__": gitlab_example()
Debug
Known issues
gotchaThe `GitLabCredentials.token` field is not mapped to Prefect secrets by default. You must provide the token explicitly via env var or Prefect block.
fix
Store the token as a Prefect Secret block and reference it using `GitLabCredentials(token=PREFECT_SECRET('my-gitlab-token'))` or pass via environment variable.
affects: all
gotcha`GitLabRepository.repository` expects a full path (e.g., 'namespace/project'), not just a project name or ID.
fix
Use the full path as shown in the GitLab UI (e.g., 'my-group/my-subgroup/my-project').
affects: all
breakingPrefect 3.x introduced breaking changes in block schema. If upgrading from Prefect 2.x, you must recreate GitLab Credentials blocks.
fix
After upgrading Prefect, delete old blocks and create new ones via the UI or CLI: `prefect block register -m prefect_gitlab`.
affects: >=0.3.0
Errors
Common errors & fixes
ImportError: cannot import name 'GitLabCredentials' from 'prefect_gitlab'
Prefect GitLab collection not installed, or wrong import path.
fix
Run `pip install prefect-gitlab` and ensure the import is `from prefect_gitlab import GitLabCredentials`.
prefect.exceptions.MissingVariableError: Variable 'GITLAB_TOKEN' not found.
Token not provided or not set as environment variable.
fix
Set the GITLAB_TOKEN environment variable, or use a Prefect Secret block: `GitLabCredentials(token=PREFECT_SECRET('my-gitlab-token'))`.
gitlab.exceptions.GitlabAuthenticationError: 401 Unauthorized
Invalid or expired GitLab personal access token.
fix
Generate a new token in GitLab (Settings > Access Tokens) and update the credentials.
Upgrade
Version history
0.3.5latest on PyPI · released Jun 12, 2026
Audit
Dependencies
prefectrequiredCore dependency; prefect-gitlab is a collection plugin for Prefect.
python-gitlabrequiredPython GitLab API client used under the hood.
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
prefect-gitlab — pip install prefect-gitlab · libregistry