Plots programming language usage over time in a git repository to an SVG file.
Project description
git-repo-language-trends
Analyze programming language usage over time in a git repository and produce a graphical or textual representation of the result.
Available output file formats:
- .svg - Scalable Vector Graphics
- .png - Portable Network Graphics
- .csv - Comma-separated values
- .tsv - Tab-separated values
Examples
Showing the pace at which TypeScript is replacing JavaScript in
mattermost-webapp
:
% cd ~/src/mattermost-webapp
% git-repo-language-trends --min-interval-days 30 --max-commits 25 --relative .ts+.tsx .js+.jsx
Showing how the implementation of CPython has grown over the last decades in terms of number of lines of C (.c and .h files) and Python (.py files):
% cd ~/src/cpython
% git-repo-language-trends --max-commits 30 --min-interval-days 365 .c+.h .py
Installation
Requirements:
- Python 3.6 or later
- pip 19.0 or later
When in doubt, begin by upgrading pip
:
python3 -m pip install --upgrade pip
Then install with
python3 -m pip install git-repo-language-trends
Usage
First go to the git repository for a project.
cd ~/src/your-project
Then run the tool, passing the file extensions for the languages you are interested in as positional arguments:
git-repo-language-trends .java .kt
For languages with multiple file extensions such as C, you can use the +
syntax which will automatically summarize line counts from both file extensions.
To compare C and Rust:
git-repo-language-trends .c+.h .rs
If you want relative numbers, enable the --relative
option:
git-repo-language-trends --relative .c+.h .rs
Use git-repo-language-trends --help
to see more options.
If git-repo-language-trends
is not in your PATH
after installation you can
run the tool via its module, e.g.:
python3 -m git_repo_language_trends --help
Method
Programming langauge usage is determined by the total number of newline characters in files with a given file extension.
It is easy to come up with something more fancy, but it would be overkill.
Performance
This program is pretty fast, because it uses the pygit2 wrapper for the C library libgit2. On my low-end computer* it counts ~400 000 lines per second.
*with an Intel® Celeron® J4005 CPU @ 2.00GHz
Development
Clone this repo:
git clone https://github.com/Enselic/git-repo-language-trends.git
Create a venv:
python3 -m venv ~/venv-grlt
source ~/venv-grlt/bin/activate
Install and update dev dependencies:
python3 -m pip install --upgrade pip flake8 pytest
Make an editable install:
python3 -m pip install -e .
then make your changes. When done, lint and test:
flake8 && pytest -vv
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
Built Distribution
File details
Details for the file git-repo-language-trends-0.0.5.tar.gz
.
File metadata
- Download URL: git-repo-language-trends-0.0.5.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba0aaa263a4b7c6987714ab45ba87934ad6717da25f559e98fa0f02703e5997 |
|
MD5 | 9c5b8cbb79cc7201aa583e52b298bcc9 |
|
BLAKE2b-256 | 3e87678e040da347bdfd4741bba5cf7d1211e06ab4c3e3caba6a0e8911bc2a6b |
File details
Details for the file git_repo_language_trends-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: git_repo_language_trends-0.0.5-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44adbbf089b7876475c1117758166068da8b15389151482b2a9ca40c781275ef |
|
MD5 | 4a8588e9e8f933eb64d08af5389d8774 |
|
BLAKE2b-256 | 87fca6c21fe561d542654a51277d7f42fa9f6ce8b03dd7449016ac68d56046e2 |