{"id":21703,"library":"prefect-gitlab","title":"prefect-gitlab","description":"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.","status":"active","version":"0.3.4","language":"python","source_language":"en","source_url":"https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-gitlab","tags":["prefect","gitlab","collection","workflow","automation"],"install":[{"cmd":"pip install prefect-gitlab","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency; prefect-gitlab is a collection plugin for Prefect.","package":"prefect","optional":false},{"reason":"Python GitLab API client used under the hood.","package":"python-gitlab","optional":false}],"imports":[{"note":"Common mistake: trying to import from prefect_gitlab.credentials or other nested paths.","symbol":"GitLabCredentials","correct":"from prefect_gitlab import GitLabCredentials"},{"note":"GitLabRepository is exposed at the top-level package.","wrong":"from prefect_gitlab.repositories import GitLabRepository","symbol":"GitLabRepository","correct":"from prefect_gitlab import GitLabRepository"}],"quickstart":{"code":"import os\nfrom prefect import flow\nfrom prefect_gitlab import GitLabCredentials, GitLabRepository\n\n@flow\ndef gitlab_example():\n    credentials = GitLabCredentials(\n        url=\"https://gitlab.com\",\n        token=os.environ.get(\"GITLAB_TOKEN\", \"\"),\n    )\n    repo = GitLabRepository(\n        credentials=credentials,\n        repository=\"namespace/project\",\n    )\n    # Example: list recent commits\n    commits = repo.list_commits()\n    print(commits)\n\nif __name__ == \"__main__\":\n    gitlab_example()","lang":"python","description":"Minimal example: instantiate GitLabCredentials with a token, then use GitLabRepository to interact with a GitLab project."},"warnings":[{"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.","message":"The `GitLabCredentials.token` field is not mapped to Prefect secrets by default. You must provide the token explicitly via env var or Prefect block.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the full path as shown in the GitLab UI (e.g., 'my-group/my-subgroup/my-project').","message":"`GitLabRepository.repository` expects a full path (e.g., 'namespace/project'), not just a project name or ID.","severity":"gotcha","affected_versions":"all"},{"fix":"After upgrading Prefect, delete old blocks and create new ones via the UI or CLI: `prefect block register -m prefect_gitlab`.","message":"Prefect 3.x introduced breaking changes in block schema. If upgrading from Prefect 2.x, you must recreate GitLab Credentials blocks.","severity":"breaking","affected_versions":">=0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install prefect-gitlab` and ensure the import is `from prefect_gitlab import GitLabCredentials`.","cause":"Prefect GitLab collection not installed, or wrong import path.","error":"ImportError: cannot import name 'GitLabCredentials' from 'prefect_gitlab'"},{"fix":"Set the GITLAB_TOKEN environment variable, or use a Prefect Secret block: `GitLabCredentials(token=PREFECT_SECRET('my-gitlab-token'))`.","cause":"Token not provided or not set as environment variable.","error":"prefect.exceptions.MissingVariableError: Variable 'GITLAB_TOKEN' not found."},{"fix":"Generate a new token in GitLab (Settings > Access Tokens) and update the credentials.","cause":"Invalid or expired GitLab personal access token.","error":"gitlab.exceptions.GitlabAuthenticationError: 401 Unauthorized"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}