Skip to main content

Universal Git Data Parser

Universal Git webhook data parser supporting GitHub, GitLab, and other SCM platforms.

Features

  • Multi-Platform Support: GitHub, GitLab, Bitbucket webhook parsing
  • Data Validation: Comprehensive validation of webhook payloads
  • Structured Output: Convert raw webhooks to structured data models
  • Error Handling: Robust error handling for malformed data
  • Type Safety: Complete type annotations with Pydantic models
  • Extensible: Easy to add support for new SCM platforms
  • Performance: Optimized parsing for high-throughput scenarios

Installation

# Basic installation
pip install yeonjae-universal-git-data-parser

# With GitHub support
pip install yeonjae-universal-git-data-parser[github]

# With GitLab support  
pip install yeonjae-universal-git-data-parser[gitlab]

# With validation features
pip install yeonjae-universal-git-data-parser[validation]

# With all features
pip install yeonjae-universal-git-data-parser[all]

Quick Start

GitHub Webhook Parsing

from yeonjae_universal_git_data_parser import GitDataParserService

# Initialize parser
parser = GitDataParserService()

# Parse GitHub push webhook
headers = {"X-GitHub-Event": "push"}
payload = {
    "repository": {"name": "my-repo", "full_name": "user/my-repo"},
    "ref": "refs/heads/main",
    "commits": [
        {
            "id": "abc123",
            "message": "Fix bug in parser",
            "author": {"name": "Developer", "email": "dev@example.com"},
            "timestamp": "2024-01-01T12:00:00Z",
            "added": ["file1.py"],
            "modified": ["file2.py"],
            "removed": []
        }
    ]
}

# Parse and validate
validated_event = parser.parse_github_push(headers, payload)

print(f"Repository: {validated_event.repository}")
print(f"Branch: {validated_event.ref}")
print(f"Commits: {len(validated_event.commits)}")

Advanced Usage

from yeonjae_universal_git_data_parser import (
    GitDataParserService, ValidatedEvent, CommitInfo
)

parser = GitDataParserService()

# Custom validation options
try:
    event = parser.parse_github_push(
        headers=headers,
        payload=payload,
        validate_signatures=True,
        strict_mode=True
    )
    
    # Access structured data
    for commit in event.commits:
        print(f"Commit: {commit.id}")
        print(f"Author: {commit.author}")
        print(f"Message: {commit.message}")
        print(f"Files changed: {len(commit.added + commit.modified + commit.removed)}")
        
except InvalidPayloadError as e:
    print(f"Invalid payload: {e}")
except UnsupportedPlatformError as e:
    print(f"Platform not supported: {e}")

Supported Platforms

Platform Push Events Pull Request Issues Tags
GitHub ✅ Full ✅ Full ⏳ Planned ⏳ Planned
GitLab ✅ Basic ⏳ Planned ⏳ Planned ⏳ Planned
Bitbucket ⏳ Planned ⏳ Planned ⏳ Planned ⏳ Planned

Data Models

The parser outputs structured Pydantic models:

  • ValidatedEvent: Main event container
  • CommitInfo: Individual commit information
  • DiffData: File change details
  • Author: Commit author information
  • FileChange: File modification details

Error Handling

Comprehensive exception hierarchy:

  • GitDataParserError: Base exception
  • InvalidPayloadError: Malformed webhook data
  • UnsupportedPlatformError: Platform not supported
  • DiffParsingError: Error parsing file changes
  • TimestampParsingError: Invalid timestamp format

License

MIT License

Metadata

Release files for yeonjae-universal-git-data-parser 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yeonjae-universal-git-data-parser 1.0.5
File Size Uploaded
yeonjae_universal_git_data_parser-1.0.5.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yeonjae-universal-git-data-parser 1.0.5
File Interpreter ABI Platform
yeonjae_universal_git_data_parser-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / yeonjae_universal_git_data_parser-1.0.5.tar.gz

Download URL yeonjae_universal_git_data_parser-1.0.5.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8635a1799e23ef8ae73f75d3d17c7dd61f62dbcc46be9648a5a6758ef1b9057e
BLAKE2b-256 checksum
How to use checksums
0bab074d4258eb923b3109795dec16b2ca22cc5f2d873be7e55304780382d42e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release files / yeonjae_universal_git_data_parser-1.0.5-py3-none-any.whl

Download URL yeonjae_universal_git_data_parser-1.0.5-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
906048696a68da29d7a1a4f26c19175d6241d0fca6b10256d1991c2a2132d914
BLAKE2b-256 checksum
How to use checksums
5693fb302e394ed60b86bc0d5d1b080aa9d1c9693f9d1567cbaded874bbba39c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page