GitToXApi


NameGitToXApi JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/git4school/gitToXApi
SummaryEnable creation and edition of xapi file from git source
upload_time2024-07-31 10:23:24
maintainerNone
docs_urlNone
authorGit4School
requires_pythonNone
licenseMIT
keywords xapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```json
"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

```py
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

```py
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

```py
import GitToXApi.utils as utils

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/git4school/gitToXApi",
    "name": "GitToXApi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "XApi",
    "author": "Git4School",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/bd/86/b418634c84ca437a599dde36149701efdf5d8ab234093c23d34a78673ff6/gittoxapi-0.2.2.tar.gz",
    "platform": null,
    "description": "# GitToXApi\n\nLibrary used to turn git change log data to xapi format\n\n## Format\n\nThe file consists of a list of xApi statements with each statement that represent a commit of the master branch.\nTo store git differential on a statement we use extensions in object.definition\n\n```json\n\"git\": [\n            {\n              \"objectType\": \"Differential\",\n              \"file\": \"test.txt\",\n              \"parts\": [\n                {\n                  \"a_start_line\": 0,\n                  \"a_interval\": 2,\n                  \"b_start_line\": 0,\n                  \"b_interval\": 2,\n                  \"content\": [\n                    \" Hello\",\n                    \"-wold\",\n                    \"+World !\",\n                  ]\n                }\n              ]\n            }\n          ]\n```\n\n## Installation\n\nUse pip to install this library : `pip install GitToXApi`\n\n## Example\n\n### Conversion\n\n```py\nimport GitToXApi.utils as utils\nfrom tincan import Statement\nimport git\nimport json\n\nrepo = git.Repo(\"path/to/example_repo\")\nstmts: list[Statement] = utils.generate_xapi(repo)\n\n# With custom git diff arguments \nstmts: list[Statement] = utils.generate_xapi(repo, {\"unified\": 1000})\n\n\n```\n\n### Serialization\n\n```py\nimport json\nwith open(\"dump.json\", \"w\") as f:\n    f.write(utils.serialize_statements(stmts))\n\n    # With custom serializing params\n    f.write(utils.serialize_statements(stmts, indent=2))\n```\n\n### Deserialization\n\n```py\nimport GitToXApi.utils as utils\n\nstmts = None\nwith open(\"dump.json\", \"r\") as f:\n    stmts = utils.deserialize_statements(f)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Enable creation and edition of xapi file from git source",
    "version": "0.2.2",
    "project_urls": {
        "Download": "https://github.com/git4school/gitToXApi/archive/refs/tags/v_0.2.tar.gz",
        "Homepage": "https://github.com/git4school/gitToXApi"
    },
    "split_keywords": [
        "xapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd86b418634c84ca437a599dde36149701efdf5d8ab234093c23d34a78673ff6",
                "md5": "1b8f21de22f77b3b72b919b84211facb",
                "sha256": "bc040b01941512441a253f2af01bddfba875ff04ea7fa8a145884026d0e89805"
            },
            "downloads": -1,
            "filename": "gittoxapi-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1b8f21de22f77b3b72b919b84211facb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6042,
            "upload_time": "2024-07-31T10:23:24",
            "upload_time_iso_8601": "2024-07-31T10:23:24.432298Z",
            "url": "https://files.pythonhosted.org/packages/bd/86/b418634c84ca437a599dde36149701efdf5d8ab234093c23d34a78673ff6/gittoxapi-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-31 10:23:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "git4school",
    "github_project": "gitToXApi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gittoxapi"
}
        
Elapsed time: 1.73196s