Skip to main content

XGIC GitLab GraphQL Client — A high-level, extensible Python client for GitLab's GraphQL API with first-class support for Work Items, hierarchical Tasks, Merge Requests, and automation use cases (including Grok Build).

Project description

XGIC GitLab GraphQL Client (xgic-gitlab-graphql)

The official XGIC GitLab GraphQL Client — a clean, extensible, Python-first client for GitLab’s GraphQL API (Python namespace: xgic.gitlab.graphql).

Goal: Replace fragile CLI-based automation (glab) with a reliable, strongly-typed Python library that Grok Build (and humans) can use comfortably. Start with Issues + child Tasks (proper Work Item hierarchy), Merge Requests, Labels, Milestones, and Releases. Designed from day one to grow into full GraphQL coverage and structured data (estimates, actuals, etc.).

Why This Exists

  • GitLab CLI escaping problems with long descriptions and complex content
  • Need for real hierarchical Tasks instead of Markdown checklists
  • Desire to move work data into structured, queryable fields
  • Grok Build works best when it can simply import a well-designed Python library

Key Features (Phase 1)

  • High-level methods: create_issue(), create_task(parent_id), create_issue_with_tasks() (create_merge_request() is a placeholder stub)
  • Proper parent-child Task hierarchy via GitLab Work Items
  • Clean data models (Issue, Task, MergeRequest) instead of raw dicts
  • Centralized error handling and GraphQL execution
  • Minimal dependencies (just requests)
  • Cross-platform (Windows + Linux)
  • Easy to install and reuse across projects

Installation

From PyPI (after publish; preferred for consumers):

uv venv
uv pip install xgic-gitlab-graphql

Development (editable):

git clone https://github.com/xgic/gitlab-graphql.git
cd gitlab-graphql
uv pip install -e ".[dev]"

Python 3.14+ required. Build/smoke with uv. Official releases use OIDC Trusted Publishing (python-package-release.md). No Makefiles.

Quick Start (Python)

from xgic.gitlab.graphql import GitLabClient

client = GitLabClient(
    token="glpat-xxxxxxxxxxxxxxxxxxxx",
    url="https://gitlab.com"   # or your self-hosted instance
)

# Create a parent issue
issue = client.create_issue(
    title="Implement new reporting feature",
    description="High-level description here...",
    namespace_path="group/project",
    labels=["feature", "backend"],
)

# Create child tasks under it
task1 = client.create_task(
    parent_id=issue.id,
    title="Design database schema",
    description="...",
    namespace_path="group/project",
)

task2 = client.create_task(
    parent_id=issue.id,
    title="Implement API endpoints",
    namespace_path="group/project",
)

print(f"Issue created: {issue.web_url}")
print(f"Tasks created under it.")

Recommended for Grok Build: Use the convenience method create_issue_with_tasks(...) whenever possible.

Project Structure

See docs/ARCHITECTURE.md and docs/development-workflow.md for layout and responsibilities.

Documentation

Engineering Tooling Philosophy

  • Build backend: hatchling (namespace packages, uv)
  • Environment / packaging: uv + pip
  • Linting / formatting: ruff (Google docstrings)
  • Type checking: pyright (strict)
  • Testing: pytest
  • Primary interface: Python library (import, not CLI)

Follows XGIC CLI standard + no Makefiles noted throughout.

Status

Core client implemented (auth, queries/mutations for work items hierarchy + pagination, models, common queries). Base standards in place. Phase 1 complete for initial use cases.

See CHANGELOG.md for details.

Multi-repo standards

Portfolio standards, ADRs, and community health:

License

Copyright 2026 XGIC.
Licensed under the Apache License, Version 2.0.
See NOTICE.

Contributing

See CONTRIBUTING.md. Use GitHub Flow: issue-named branches, Conventional Commits, human review in the GitHub UI before merge to main.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xgic_gitlab_graphql-0.1.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xgic_gitlab_graphql-0.1.2-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file xgic_gitlab_graphql-0.1.2.tar.gz.

File metadata

  • Download URL: xgic_gitlab_graphql-0.1.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for xgic_gitlab_graphql-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1f78f97403d176de279cbdbcf150002333c283b5c33d258299645b568e740746
MD5 5ec76bd6a09995a43f653fa278db857c
BLAKE2b-256 3db51f9e31f442fe56a72c6b540b1fd3e047f0ec7c8da6954d9ae6a4d8cb26d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for xgic_gitlab_graphql-0.1.2.tar.gz:

Publisher: release.yml on xgic/gitlab-graphql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xgic_gitlab_graphql-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for xgic_gitlab_graphql-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b6afc04c97e01d218b3f0223d7796941b2accd4b34fa5b46e510da3540df1b2d
MD5 d1991e17eec7774cb640acd718b13125
BLAKE2b-256 d45c1f84a0964ff98ecb79b28c2c4d2bec7a5acc9e7e27029e2da91bf7d6325b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xgic_gitlab_graphql-0.1.2-py3-none-any.whl:

Publisher: release.yml on xgic/gitlab-graphql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page