python-gitlab
The python wrapper for the GitLab REST and GraphQL APIs.
What it is and what it does
python-gitlab is a Python client library that wraps GitLab's v4 REST API and provides both synchronous and asynchronous GraphQL clients. It lets you write Pythonic code to manage GitLab resources—projects, issues, merge requests, users, and more—without hand-crafting HTTP requests. The package includes a command-line tool (gitlab) for direct API access and handles common concerns like authentication, retries, rate limiting, pagination, and URL encoding automatically.
The library depends on requests and requests-toolbelt for HTTP communication and supports Python 3.10 and later. It's designed for system administrators and developers who need to automate GitLab operations, integrate GitLab into larger workflows, or script repetitive tasks. You can pass arbitrary parameters to the API, access endpoints as soon as they're available on GitLab, and use persistent sessions for proxy and certificate handling.
Use it for:
- Automate GitLab project and user management tasks in CI/CD pipelines or administrative scripts.
- Query and modify issues, merge requests, and other resources programmatically from Python applications.
- Build custom integrations between GitLab and external systems using REST or GraphQL APIs.
- Write CLI scripts to manage GitLab instances without manual web UI interaction.
- Implement rate-limit-aware bulk operations on GitLab resources with automatic retry logic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python wrapper for GitLab's REST and GraphQL APIs, with a CLI tool for managing GitLab resources and accessing API endpoints.
Yes. The package is actively maintained, has low install friction, no known vulnerabilities, and is in the top 5000 PyPI packages by download volume. The copyleft license is standard for GitLab tooling. Install it if you need to programmatically interact with GitLab APIs from Python.
Install
python-gitlab on PyPI
pip
pip install python-gitlabuv
uv add python-gitlabpoetry
poetry add python-gitlabInstalling python-gitlab
Before you install
Low friction install with only two runtime dependencies (requests and requests-toolbelt). Active maintenance with a recent release 17 days ago and consistent commit activity.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). Any derivative work or distribution must preserve the same license terms and make source code available.
Quickstart
pip install python-gitlab
import gitlab
gl = gitlab.Gitlab('https://gitlab.example.com', private_token='your-token')
project = gl.projects.get('project-id')
print(project.name)
Requires Python 3.10 or later and a valid GitLab instance URL with authentication token.
Verify before relying
- Whether async GraphQL support requires additional dependencies beyond requests and requests-toolbelt.
- Performance characteristics when handling large paginated responses or high-volume API calls.
- Specific GitLab server version compatibility beyond the general API v4 support.
Package facts
| License | LGPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.10.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — requests, requests-toolbelt |
| Maintenance | actively maintained — 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 21,035,573/month — #1,018 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_gitlab-8.5.0-py3-none-any.whl
Keywords: api, client, gitlab, python, python-gitlab, wrapper
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
linear-apiA Python wrapper for the Linear API that…
permissive · top 15,000 on PyPI
pulumi-gitlabPulumi provider for GitLab that lets you define…
permissive · top 15,000 on PyPI
graphqlclientA lightweight GraphQL client that sends queries…
permissive · top 15,000 on PyPI
python-graphql-clientSends GraphQL queries, mutations, and…
permissive · top 15,000 on PyPI
graphql-serverGraphQL-Server provides helper functions to…
permissive · top 15,000 on PyPI
gqlA GraphQL client for Python that executes…
permissive · top 1,000 on PyPI
pylint-gitlabProvides custom pylint output formatters that…
copyleft · top 5,000 on PyPI
simple-rest-clientA lightweight HTTP client library for building…
unclear · top 15,000 on PyPI
sgqlcsgqlc is a Python client library for querying…
permissive · top 5,000 on PyPI
oauthlibOAuthLib implements OAuth 1.0 and OAuth 2.0…
permissive · top 1,000 on PyPI