Skip to main content

A python package to extract features from a commit patch.

Project description

PatchParser

A python package to extract features from a commit patch.

Please note this repository is still in the initial development phase.

Installation

Use the package manager pip to install patchparser.

pip install patchparser

Usage

from patchparser import github_parser

if __name__ == '__main__':
    # Parse a given commit for a GitHub repository
    parsed = github_parser.commit(repo_owner="Lightning-AI",
                                  repo_name="lightning",
                                  sha="62f1e82e032eb16565e676d39e0db0cac7e34ace")

Parsed Features

Columns Type Description
repo_owner str Repository Owner
repo_name str Repository Name
sha str Target Commit SHA
message str Associated commit message
file_name str Name of file altered in patch
file_number int File number in patch
file_extension str File extension
total_files_changed int Number of files changed at commit
raw_file_patch str The raw patch for the entire file
patch_number int Patch instance
total_patches int Total number of patches per file
raw_patch_header str Header of the patch (@@ -A,X +B,Y @@)
raw_patch str The raw patch for a single patch
original_code str The left side (parent commit state) of the git diff in GitHub. Raw code. -'s are stripped.
original_line_start int Original line start number (@@ -A,X +B,Y @@)
original_line_length int Original line end (@@ -A,X +B,Y @@)
original_line_end int Original_line_start + original_line_length
modified_code str The right side (target commit state) of the git diff in GitHub. Raw code. +'s are stripped.
modified_line_start int Modified line start number (@@ -A,X +B,Y @@)
modified_line_length int Modified line end (@@ -A,X +B,Y @@)
modified_line_end int Modified_line_start + modified_line_length
additions int Added lines count in a patch
added_code str Raw code added during patch
deletions int Deleted lines count in a patch
deleted_code str Raw code deleted during patch
changes int additions + deletions
status str GitHub status tag at file level (e.g., modified)
total_additions int Total lines added for a file
total_deletions int Total lines deleted for a file
total_changes int Total lines changed for a file (total_additions + total_deletions)
commit_author_name str Author name of commit
commit_author_login str Author login of commit
commit_author_email str Author email of commit
commit_author_date str Author commit date
commit_committer_name str Committer name of commit
commit_committer_login str Committer login of commit
commit_committer_email str Committer email of commit
commit_committer_date str Committer commit date
commit_tree_sha str Commit tree SHA
commit_tree_url str Commit tree URL
commit_verification_verified bool Boolean verfication status
commit_verification_reason str Verfication reason
parents list Parent commit SHAs of target SHA

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Unlicense

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

patchparser-0.0.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

patchparser-0.0.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file patchparser-0.0.3.tar.gz.

File metadata

  • Download URL: patchparser-0.0.3.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for patchparser-0.0.3.tar.gz
Algorithm Hash digest
SHA256 60d7e448ad2e0f983e81c5b22cc881e10ed273418cea520998ab5cede277b49a
MD5 08854fac72655c1d37efa4e026bec815
BLAKE2b-256 ccbdd8d8ba061fa11015f096dc0c126e2da18b2fd41ae70dc2ded317895ea16d

See more details on using hashes here.

File details

Details for the file patchparser-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: patchparser-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for patchparser-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c95f5842abe09cb12878dcc4890106b6b0be67ba587287c24b08715e7d8414b
MD5 47e330ce0879092a37b59170576e413f
BLAKE2b-256 65292eae6eb5ea1088a1853bff2c2c87fb18a4d0985e55774d9246bd196dcb3c

See more details on using hashes here.

Supported by

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