Skip to main content

Transform GitHub Activities to Pandas Dataframes

General information

This package is being developed by the participating partners (TU Bergakademie Freiberg, OVGU Magdeburg and HU Berlin) as part of the DiP-iT project Website.

The package implements Python functions for

  • aggregating and preprocessing GitHub activities (Commits, Actions, Issues, Pull-Requests) and
  • generating project progress summaries according to different metrics (ratio of changed lines, ratio of aggregated Levenshtein distances e.g.).

github2pandas stores the collected information in a collection of pandas DataFrames starting from a user defined root folder. The structure beyond that (file names, folder names) is defined as a member variable in the corresponding classes and can be overwritten. The default configuration results in the following file structure.

|-- My_Github_Repository_0               <- Repository name
|   |- Repo.json                         <- Json file containing user and repo name
|   |- Repository
|   |   |- Repository.p  
|   |- Issues
|   |   |- pdIssuesComments.p
|   |   |- pdIssuesEvents.p
|   |   |- pdIssues.p
|   |   |- pdIssuesReactions.p
|   |- PullRequests
|   |   |- pdPullRequestsComments.p
|   |   |- pdPullRequestsCommits.p
|   |   |- pdPullRequestsEvents.p
|   |   |- pdPullRequests.p
|   |   |- pdPullRequestsReactions.p
|   |   |- pdPullRequestsReviews.p
|   |- Users.p
|   |- Versions
|   |   |- pdCommits.p
|   |   |- pdEdits.p
|   |   |- pdBranches.p
|   |   |- pVersions.db
|   |   |- repo                         <- Repository clone
|   |   |   |- ..
|   |- Workflows
|       |- pdWorkflows.p
|-- My_Github_Repository_1
...

The internal structure and relations of the data frames are included in the project's wiki.

Installation

github2pandas is available on pypi. Use pip to install the package.

global

On Linux:

sudo pip3 install github2pandas 
sudo pip install github2pandas

On Windows as admin or for one user:

pip install github2pandas
pip install --user github2pandas 

in virtual environment:

pipenv install github2pandas

Usage

GitHub token is required for use, which is used for authentication. The website describes how you can generate this for your GitHub account. Customise the username and project name and explore any public or private repository you have access to with your account!

Access token is to define in .env oder .py (.ipynb) file. The default value of python.envFile setting is ${workspaceFolder}/.env

TOKEN="example_token"

An short example of a python script:

import os
from pathlib import Path
# github2pandas imports
from github2pandas.core import Core
from github2pandas.github2pandas import GitHub2Pandas

git_repo_name = "github2pandas"
git_repo_owner = "TUBAF-IFI-DiPiT"
    
data_root_dir = Path("data")
data_root_dir.mkdir(parents=True, exist_ok=True)
github_token = os.environ['TOKEN']

github2pandas = GitHub2Pandas(github_token,data_root_dir)
repo = github2pandas.get_repo(git_repo_owner, git_repo_name)
# extract complete repository
github2pandas.generate_pandas_tables(repo)

# exports pandas files to one excel file
GitHub2Pandas.save_tables_to_excel(Path(data_root_dir,git_repo_owner,git_repo_name))

Notebook examples

Currently not updated for github2pandas version 2.0.0!! The corresponding github2pandas_notebooks repository illustrates the usage with examplary investigations.

The documentation of the module is available at https://github2pandas.readthedocs.io/.

Working with pipenv

Process Command
Installation pipenv install --dev
Run specific script pipenv run python file.py
Run all Tests pipenv run python -m unittest
Run all tests in a specific folder pipenv run python -m unittest discover -s 'tests'
Run all tests with specific filename pipenv run python -m unittest discover -p 'test_*.py'
Start Jupyter server in virtual environment pipenv run jupyter notebook

For Contributors

Naming conventions: https://namingconvention.org/python/

Release files for github2pandas 2.0.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 github2pandas 2.0.2
File Size Uploaded
github2pandas-2.0.2.tar.gz 29.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for github2pandas 2.0.2
File Interpreter ABI Platform
github2pandas-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 64.7 kB

Release files / github2pandas-2.0.2.tar.gz

Download URL github2pandas-2.0.2.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d55761a2870fec5a21af8349da4e54b1ac4bcbcbccba00470e079b34a96113c6
BLAKE2b-256 checksum
How to use checksums
88a2684e729a4de6289d87a800ec5f87377c21d44d1ed8593079169da2f22758
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.4

Release files / github2pandas-2.0.2-py3-none-any.whl

Download URL github2pandas-2.0.2-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79e010db80d0dd0f5455401f037071cf3f531a79ebb3731c95ba82e6aab0e7bb
BLAKE2b-256 checksum
How to use checksums
13b02cb359f9951817d7025ddc371fcf669ef982a6f61d9567fb5e6cf1312727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.4

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.18

2 release files

1.1.15

2 release files

1.1.14

2 release files

1.1.13

2 release files

1.1.12

2 release files

1.1.11

2 release files

1.1.10

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.31

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

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