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.1.tar.gz (19.9 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.1-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xgic_gitlab_graphql-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c55151fa7809079d629f811be4505dd855d96584654ddc6df8b81615daa365a5
MD5 a13c8544c4243c0683e68c7e2c7c13a7
BLAKE2b-256 4a8e15449004cc2d112e800928dfaac8721c616fc8725761cab075620381e9ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for xgic_gitlab_graphql-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for xgic_gitlab_graphql-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45c78c4ecfe570d1d180ef7c31eca09c4e5f76adb53a27fc8e7c27663d37bbc8
MD5 bc8bf787f9ee150e3d3e067bb004bf13
BLAKE2b-256 e37d3bb1354dc1897f83546c1bf358e20159f4944a9b33383261943188c4d553

See more details on using hashes here.

Provenance

The following attestation bundles were made for xgic_gitlab_graphql-0.1.1-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