Skip to main content

GitToXApi

Library used to turn git change log data to xapi format

Format

The file consists of a list of xApi statements with each statement that represent a commit of the master branch. To store git differential on a statement we use extensions in object.definition

"git": [
            {
              "objectType": "Differential",
              "file": "test.txt",
              "parts": [
                {
                  "a_start_line": 0,
                  "a_interval": 2,
                  "b_start_line": 0,
                  "b_interval": 2,
                  "content": [
                    " Hello",
                    "-wold",
                    "+World !",
                  ]
                }
              ]
            }
          ]

Installation

Use pip to install this library : pip install GitToXApi

Example

Conversion

import GitToXApi.utils as utils
from tincan import Statement
import git
import json

repo = git.Repo("path/to/example_repo")
stmts: list[Statement] = utils.generate_xapi(repo)

# With custom git diff arguments 
stmts: list[Statement] = utils.generate_xapi(repo, {"unified": 1000})

Serialization

import json
with open("dump.json", "w") as f:
    f.write(utils.serialize_statements(stmts))

    # With custom serializing params
    f.write(utils.serialize_statements(stmts, indent=2))

Deserialization

import GitToXApi.utils as utils

stmts = None
with open("dump.json", "r") as f:
    stmts = utils.deserialize_statements(f)

Metadata

Release files for GitToXApi 0.2.2

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

Source distribution (sdist)

Source distribution for GitToXApi 0.2.2
File Size Uploaded Provenance Actions
gittoxapi-0.2.2.tar.gz 6.0 kB Without provenance Details for gittoxapi-0.2.2.tar.gz

Release files / gittoxapi-0.2.2.tar.gz

Download URL gittoxapi-0.2.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bc040b01941512441a253f2af01bddfba875ff04ea7fa8a145884026d0e89805
BLAKE2b-256 checksum
How to use checksums
bd86b418634c84ca437a599dde36149701efdf5d8ab234093c23d34a78673ff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for GitToXApi 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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