Python Framework to analyse Git repositories
966
stars
840
commits
Python
primary language
Sep 4, 2026
updated
PyDriller is a Python framework that helps developers in analyzing Git repositories. With PyDriller you can easily extract information about commits, developers, modified files, diffs, and source code.
pip install pydriller
from pydriller import Repository
for commit in Repository('https://github.com/ishepard/pydriller').traverse_commits():
print(commit.hash)
print(commit.msg)
print(commit.author.name)
for file in commit.modified_files:
print(file.filename, ' has changed')
Read the docs for more usage examples. Furthermore, a video is available on Youtube.
@inproceedings{Spadini2018,
address = {New York, New York, USA},
author = {Spadini, Davide and Aniche, Maur\'{i}cio and Bacchelli, Alberto},
booktitle = {Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering - ESEC/FSE 2018},
doi = {10.1145/3236024.3264598},
isbn = {9781450355735},
keywords = {2018,acm reference format,and alberto bacchelli,davide spadini,git,gitpython,maur\'{i}cio aniche,mining software repositories,pydriller,python},
pages = {908--911},
publisher = {ACM Press},
title = {{PyDriller: Python framework for mining software repositories}},
url = {http://dl.acm.org/citation.cfm?doid=3236024.3264598},
year = {2018}
}
git clone https://github.com/ishepard/pydriller.git
cd pydriller
virtualenv. Therefore, before installing the requirements run:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
unzip test-repos.zip
pip install -r test-requirements.txt
pip install -r dev-requirements.txt
(Important) I tend to not accept Pull Requests without tests, so:
test-repos.zip zip filetest-repos.zip that includes your new repository, otherwise the tests will fail.Run the test suite with pytest:
pytest
Run the test suite with a coverage report as terminal output:
pytest --cov-report term --cov=pydriller tests/
alternatively run:
make testcoverage
PyDriller source code is annotated for type checking, see syntax. The mypy type checker is executed on each pull request. That is, code that does not type check will not pass that build step, see CI step. Run the type checker locally:
mypy --ignore-missing-imports pydriller/ tests/
alternatively run:
make typecheck
PyDriller relies on the Flake8 linter to check and enforce code style. The linter is executed on each pull request. That is, code that does not conform to code style rules as formulated by Flake8, will not pass that build step, see CI step. Run the type checker locally:
flake8
alternatively run:
make lint
PyDriller's CI chain executes a set of CodeQL queries related to Python quality and security. Currently, a local CodeQL setup is quite big (>1.7GB) and require multiple setup and configuration steps. Therefore, it is omitted here and in the Makefile.
This project has received funding from the European Union's Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No. 642954.
(top 30 of 39)
Python
99.9%
Python Framework to analyse Git repositories
966
stars
840
commits
Python
primary language
Sep 4, 2026
updated
PyDriller is a Python framework that helps developers in analyzing Git repositories. With PyDriller you can easily extract information about commits, developers, modified files, diffs, and source code.
pip install pydriller
from pydriller import Repository
for commit in Repository('https://github.com/ishepard/pydriller').traverse_commits():
print(commit.hash)
print(commit.msg)
print(commit.author.name)
for file in commit.modified_files:
print(file.filename, ' has changed')
Read the docs for more usage examples. Furthermore, a video is available on Youtube.
@inproceedings{Spadini2018,
address = {New York, New York, USA},
author = {Spadini, Davide and Aniche, Maur\'{i}cio and Bacchelli, Alberto},
booktitle = {Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering - ESEC/FSE 2018},
doi = {10.1145/3236024.3264598},
isbn = {9781450355735},
keywords = {2018,acm reference format,and alberto bacchelli,davide spadini,git,gitpython,maur\'{i}cio aniche,mining software repositories,pydriller,python},
pages = {908--911},
publisher = {ACM Press},
title = {{PyDriller: Python framework for mining software repositories}},
url = {http://dl.acm.org/citation.cfm?doid=3236024.3264598},
year = {2018}
}
git clone https://github.com/ishepard/pydriller.git
cd pydriller
virtualenv. Therefore, before installing the requirements run:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
unzip test-repos.zip
pip install -r test-requirements.txt
pip install -r dev-requirements.txt
(Important) I tend to not accept Pull Requests without tests, so:
test-repos.zip zip filetest-repos.zip that includes your new repository, otherwise the tests will fail.Run the test suite with pytest:
pytest
Run the test suite with a coverage report as terminal output:
pytest --cov-report term --cov=pydriller tests/
alternatively run:
make testcoverage
PyDriller source code is annotated for type checking, see syntax. The mypy type checker is executed on each pull request. That is, code that does not type check will not pass that build step, see CI step. Run the type checker locally:
mypy --ignore-missing-imports pydriller/ tests/
alternatively run:
make typecheck
PyDriller relies on the Flake8 linter to check and enforce code style. The linter is executed on each pull request. That is, code that does not conform to code style rules as formulated by Flake8, will not pass that build step, see CI step. Run the type checker locally:
flake8
alternatively run:
make lint
PyDriller's CI chain executes a set of CodeQL queries related to Python quality and security. Currently, a local CodeQL setup is quite big (>1.7GB) and require multiple setup and configuration steps. Therefore, it is omitted here and in the Makefile.
This project has received funding from the European Union's Horizon 2020 research and innovation programme under the Marie Sklodowska-Curie grant agreement No. 642954.
(top 30 of 39)
Python
99.9%