Skip to main content
Git-Pandas
==========

v0.0.3

A simple set of wrappers around gitpython for creating pandas dataframes out of git data. The project is centered around
two primary objects:

* Repository()
* ProjectDirectory()

A Repository object contains a single git repo, and is used to interact with it. A ProjectDirectory references a directory
in your filesystem which may have in it multiple git repositories. The subdirectories are all walked to find any child
repos, and any analysis is aggregated up from all of those into a single output (pandas dataframe).

Current functionality includes:

* Commit history with extension and directory filtering
* Edited files history with extension and directory filtering
* Blame with extension and directory filtering
* Branches
* Tags
* ProjectDirectory-level general information table
* Approximate bus factor for projects and repos

Please see examples for more detailed usage.

Installation
------------

To install use:

pip install git-pandas

Documentation
-------------

Docs can be found here: [http://wdm0006.github.io/git-pandas/](http://wdm0006.github.io/git-pandas/)

Examples / Usage
----------------

A repository is just 1 git repo:

from gitpandas import Repository
from pandas import set_option

set_option('display.height', 1000)
set_option('display.max_rows', 500)
set_option('display.max_columns', 500)
set_option('display.width', 1000)

# build an example repository object and try some things out
dir = ''
ignore_dirs = [
'docs',
'tests',
'Data'
]
r = Repository(dir)

# is it bare?
print('\nRepo bare?')
print(r.is_bare())
print('\n')

# get the commit history
ch = r.commit_history('develop', limit=None, extensions=['py'], ignore_dir=ignore_dirs)
print(ch.head(5))

# get the list of committers
print('\nCommiters:')
print(''.join([str(x) + '\n' for x in set(ch['committer'].values)]))
print('\n')

# print out everyone's contributions
attr = ch.reindex(columns=['committer', 'lines', 'insertions', 'deletions']).groupby(['committer'])
attr = attr.agg({
'lines': np.sum,
'insertions': np.sum,
'deletions': np.sum
})
print(attr)

# get the file change history
fh = r.file_change_history('develop', limit=None, ignore_dir=ignore_dirs)
fh['ext'] = fh['filename'].map(lambda x: x.split('.')[-1])
print(fh.head(50))

# print out unique extensions
print('\nExtensions Found:')
print(''.join([str(x) + '\n' for x in set(fh['ext'].values)]))
print('\n')

# agg by extension
etns = fh.reindex(columns=['ext', 'insertions', 'deletions']).groupby(['ext'])
etns = etns.agg({
'insertions': np.sum,
'deletions': np.sum
})
print(etns)

A project is a collection of repositories:

from pandas import set_option
from gitpandas import ProjectDirectory

set_option('display.height', 1000)
set_option('display.max_rows', 500)
set_option('display.max_columns', 500)
set_option('display.width', 1000)

p = ProjectDirectory(working_dir='/foo/bar/')

# get the commit history
ch = p.commit_history('develop', limit=None)
print(ch.head(5))

# get the list of committers
print('\nCommitters:')
print(''.join([str(x) + '\n' for x in set(ch['committer'].values)]))
print('\n')

# print out everyone's contributions
attr = ch.reindex(columns=['committer', 'lines', 'insertions', 'deletions']).groupby(['committer'])
attr = attr.agg({
'lines': np.sum,
'insertions': np.sum,
'deletions': np.sum
})
print(attr)

Contributing
------------

If you'd like to contribute, let me know, or just submit a pull request. We have no specific long term goals or guidelines
at this stage.

License
-------

This is BSD licensed (see License.md)

Metadata

Release files for git-pandas 0.0.3

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

Source distribution (sdist)

Source distribution for git-pandas 0.0.3
File Size Uploaded
git-pandas-0.0.3.tar.gz 7.5 kB Details

Release files / git-pandas-0.0.3.tar.gz

Download URL git-pandas-0.0.3.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1b22a8a2c3ddc6b3d1b15b3a3fdb1f640a0a8361ef3ebc6a80e5b59275e93812
BLAKE2b-256 checksum
How to use checksums
50e9344c74ad68eabed02024368c816a071015ef176991499f33cc666e6f2267
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.6.0

1 release file

2.5.0

1 release file

2.3.0

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.0

1 release file

1.2.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

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